Skip to content

Commit 32a92f8

Browse files
committed
Convert more 'alloc_obj' cases to default GFP_KERNEL arguments
This converts some of the visually simpler cases that have been split over multiple lines. I only did the ones that are easy to verify the resulting diff by having just that final GFP_KERNEL argument on the next line. Somebody should probably do a proper coccinelle script for this, but for me the trivial script actually resulted in an assertion failure in the middle of the script. I probably had made it a bit _too_ trivial. So after fighting that far a while I decided to just do some of the syntactically simpler cases with variations of the previous 'sed' scripts. The more syntactically complex multi-line cases would mostly really want whitespace cleanup anyway. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 323bbfc commit 32a92f8

File tree

826 files changed

+1211
-2422
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

826 files changed

+1211
-2422
lines changed

arch/arm/mach-omap1/mcbsp.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,8 +294,7 @@ static void omap_mcbsp_register_board_cfg(struct resource *res, int res_count,
294294
{
295295
int i;
296296

297-
omap_mcbsp_devices = kzalloc_objs(struct platform_device *, size,
298-
GFP_KERNEL);
297+
omap_mcbsp_devices = kzalloc_objs(struct platform_device *, size);
299298
if (!omap_mcbsp_devices) {
300299
printk(KERN_ERR "Could not register McBSP devices\n");
301300
return;

arch/arm64/kernel/vdso.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ static int __init __vdso_init(enum vdso_abi abi)
8181
vdso_info[abi].vdso_code_start) >>
8282
PAGE_SHIFT;
8383

84-
vdso_pagelist = kzalloc_objs(struct page *, vdso_info[abi].vdso_pages,
85-
GFP_KERNEL);
84+
vdso_pagelist = kzalloc_objs(struct page *, vdso_info[abi].vdso_pages);
8685
if (vdso_pagelist == NULL)
8786
return -ENOMEM;
8887

arch/loongarch/kernel/vdso.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ static int __init init_vdso(void)
5252

5353
vdso_info.size = PAGE_ALIGN(vdso_end - vdso_start);
5454
vdso_info.code_mapping.pages =
55-
kzalloc_objs(struct page *, vdso_info.size / PAGE_SIZE,
56-
GFP_KERNEL);
55+
kzalloc_objs(struct page *, vdso_info.size / PAGE_SIZE);
5756

5857
if (!vdso_info.code_mapping.pages)
5958
return -ENOMEM;

arch/powerpc/kvm/book3s_pr.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1738,8 +1738,7 @@ static int kvmppc_core_vcpu_create_pr(struct kvm_vcpu *vcpu)
17381738
vcpu->arch.book3s = vcpu_book3s;
17391739

17401740
#ifdef CONFIG_KVM_BOOK3S_32_HANDLER
1741-
vcpu->arch.shadow_vcpu = kzalloc_obj(*vcpu->arch.shadow_vcpu,
1742-
GFP_KERNEL);
1741+
vcpu->arch.shadow_vcpu = kzalloc_obj(*vcpu->arch.shadow_vcpu);
17431742
if (!vcpu->arch.shadow_vcpu)
17441743
goto free_vcpu3s;
17451744
#endif

arch/powerpc/mm/book3s64/mmu_context.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,7 @@ static int hash__init_new_context(struct mm_struct *mm)
9696
{
9797
int index;
9898

99-
mm->context.hash_context = kmalloc_obj(struct hash_mm_context,
100-
GFP_KERNEL);
99+
mm->context.hash_context = kmalloc_obj(struct hash_mm_context);
101100
if (!mm->context.hash_context)
102101
return -ENOMEM;
103102

@@ -124,8 +123,7 @@ static int hash__init_new_context(struct mm_struct *mm)
124123
#ifdef CONFIG_PPC_SUBPAGE_PROT
125124
/* inherit subpage prot details if we have one. */
126125
if (current->mm->context.hash_context->spt) {
127-
mm->context.hash_context->spt = kmalloc_obj(struct subpage_prot_table,
128-
GFP_KERNEL);
126+
mm->context.hash_context->spt = kmalloc_obj(struct subpage_prot_table);
129127
if (!mm->context.hash_context->spt) {
130128
kfree(mm->context.hash_context);
131129
return -ENOMEM;

arch/powerpc/perf/hv-24x7.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -917,8 +917,7 @@ static int create_events_from_catalog(struct attribute ***events_,
917917
goto e_event_attrs;
918918
}
919919

920-
event_long_descs = kmalloc_objs(*event_long_descs, event_idx + 1,
921-
GFP_KERNEL);
920+
event_long_descs = kmalloc_objs(*event_long_descs, event_idx + 1);
922921
if (!event_long_descs) {
923922
ret = -ENOMEM;
924923
goto e_event_descs;

arch/powerpc/perf/imc-pmu.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1527,8 +1527,7 @@ static int init_nest_pmu_ref(void)
15271527
{
15281528
int nid, i, cpu;
15291529

1530-
nest_imc_refc = kzalloc_objs(*nest_imc_refc, num_possible_nodes(),
1531-
GFP_KERNEL);
1530+
nest_imc_refc = kzalloc_objs(*nest_imc_refc, num_possible_nodes());
15321531

15331532
if (!nest_imc_refc)
15341533
return -ENOMEM;
@@ -1714,14 +1713,12 @@ static int imc_mem_init(struct imc_pmu *pmu_ptr, struct device_node *parent,
17141713
goto err;
17151714

17161715
nr_cores = DIV_ROUND_UP(num_possible_cpus(), threads_per_core);
1717-
pmu_ptr->mem_info = kzalloc_objs(struct imc_mem_info, nr_cores,
1718-
GFP_KERNEL);
1716+
pmu_ptr->mem_info = kzalloc_objs(struct imc_mem_info, nr_cores);
17191717

17201718
if (!pmu_ptr->mem_info)
17211719
goto err;
17221720

1723-
core_imc_refc = kzalloc_objs(struct imc_pmu_ref, nr_cores,
1724-
GFP_KERNEL);
1721+
core_imc_refc = kzalloc_objs(struct imc_pmu_ref, nr_cores);
17251722

17261723
if (!core_imc_refc) {
17271724
kfree(pmu_ptr->mem_info);
@@ -1754,8 +1751,7 @@ static int imc_mem_init(struct imc_pmu *pmu_ptr, struct device_node *parent,
17541751
return -ENOMEM;
17551752

17561753
nr_cores = DIV_ROUND_UP(num_possible_cpus(), threads_per_core);
1757-
trace_imc_refc = kzalloc_objs(struct imc_pmu_ref, nr_cores,
1758-
GFP_KERNEL);
1754+
trace_imc_refc = kzalloc_objs(struct imc_pmu_ref, nr_cores);
17591755
if (!trace_imc_refc)
17601756
return -ENOMEM;
17611757

arch/powerpc/platforms/powernv/idle.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1336,8 +1336,7 @@ static int __init pnv_parse_cpuidle_dt(void)
13361336
nr_idle_states = of_property_count_u32_elems(np,
13371337
"ibm,cpu-idle-state-flags");
13381338

1339-
pnv_idle_states = kzalloc_objs(*pnv_idle_states, nr_idle_states,
1340-
GFP_KERNEL);
1339+
pnv_idle_states = kzalloc_objs(*pnv_idle_states, nr_idle_states);
13411340
temp_u32 = kcalloc(nr_idle_states, sizeof(u32), GFP_KERNEL);
13421341
temp_u64 = kcalloc(nr_idle_states, sizeof(u64), GFP_KERNEL);
13431342
temp_string = kcalloc(nr_idle_states, sizeof(char *), GFP_KERNEL);

arch/powerpc/platforms/powernv/memtrace.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,7 @@ static int memtrace_init_regions_runtime(u64 size)
133133
u32 nid;
134134
u64 m;
135135

136-
memtrace_array = kzalloc_objs(struct memtrace_entry, num_online_nodes(),
137-
GFP_KERNEL);
136+
memtrace_array = kzalloc_objs(struct memtrace_entry, num_online_nodes());
138137
if (!memtrace_array) {
139138
pr_err("Failed to allocate memtrace_array\n");
140139
return -EINVAL;

arch/powerpc/platforms/powernv/opal-imc.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,7 @@ static int imc_get_mem_addr_nest(struct device_node *node,
108108
nr_chips))
109109
goto error;
110110

111-
pmu_ptr->mem_info = kzalloc_objs(*pmu_ptr->mem_info, nr_chips + 1,
112-
GFP_KERNEL);
111+
pmu_ptr->mem_info = kzalloc_objs(*pmu_ptr->mem_info, nr_chips + 1);
113112
if (!pmu_ptr->mem_info)
114113
goto error;
115114

0 commit comments

Comments
 (0)