mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
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>
This commit is contained in:
@@ -294,8 +294,7 @@ static void omap_mcbsp_register_board_cfg(struct resource *res, int res_count,
|
||||
{
|
||||
int i;
|
||||
|
||||
omap_mcbsp_devices = kzalloc_objs(struct platform_device *, size,
|
||||
GFP_KERNEL);
|
||||
omap_mcbsp_devices = kzalloc_objs(struct platform_device *, size);
|
||||
if (!omap_mcbsp_devices) {
|
||||
printk(KERN_ERR "Could not register McBSP devices\n");
|
||||
return;
|
||||
|
||||
@@ -81,8 +81,7 @@ static int __init __vdso_init(enum vdso_abi abi)
|
||||
vdso_info[abi].vdso_code_start) >>
|
||||
PAGE_SHIFT;
|
||||
|
||||
vdso_pagelist = kzalloc_objs(struct page *, vdso_info[abi].vdso_pages,
|
||||
GFP_KERNEL);
|
||||
vdso_pagelist = kzalloc_objs(struct page *, vdso_info[abi].vdso_pages);
|
||||
if (vdso_pagelist == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
|
||||
@@ -52,8 +52,7 @@ static int __init init_vdso(void)
|
||||
|
||||
vdso_info.size = PAGE_ALIGN(vdso_end - vdso_start);
|
||||
vdso_info.code_mapping.pages =
|
||||
kzalloc_objs(struct page *, vdso_info.size / PAGE_SIZE,
|
||||
GFP_KERNEL);
|
||||
kzalloc_objs(struct page *, vdso_info.size / PAGE_SIZE);
|
||||
|
||||
if (!vdso_info.code_mapping.pages)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -1738,8 +1738,7 @@ static int kvmppc_core_vcpu_create_pr(struct kvm_vcpu *vcpu)
|
||||
vcpu->arch.book3s = vcpu_book3s;
|
||||
|
||||
#ifdef CONFIG_KVM_BOOK3S_32_HANDLER
|
||||
vcpu->arch.shadow_vcpu = kzalloc_obj(*vcpu->arch.shadow_vcpu,
|
||||
GFP_KERNEL);
|
||||
vcpu->arch.shadow_vcpu = kzalloc_obj(*vcpu->arch.shadow_vcpu);
|
||||
if (!vcpu->arch.shadow_vcpu)
|
||||
goto free_vcpu3s;
|
||||
#endif
|
||||
|
||||
@@ -96,8 +96,7 @@ static int hash__init_new_context(struct mm_struct *mm)
|
||||
{
|
||||
int index;
|
||||
|
||||
mm->context.hash_context = kmalloc_obj(struct hash_mm_context,
|
||||
GFP_KERNEL);
|
||||
mm->context.hash_context = kmalloc_obj(struct hash_mm_context);
|
||||
if (!mm->context.hash_context)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -124,8 +123,7 @@ static int hash__init_new_context(struct mm_struct *mm)
|
||||
#ifdef CONFIG_PPC_SUBPAGE_PROT
|
||||
/* inherit subpage prot details if we have one. */
|
||||
if (current->mm->context.hash_context->spt) {
|
||||
mm->context.hash_context->spt = kmalloc_obj(struct subpage_prot_table,
|
||||
GFP_KERNEL);
|
||||
mm->context.hash_context->spt = kmalloc_obj(struct subpage_prot_table);
|
||||
if (!mm->context.hash_context->spt) {
|
||||
kfree(mm->context.hash_context);
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -917,8 +917,7 @@ static int create_events_from_catalog(struct attribute ***events_,
|
||||
goto e_event_attrs;
|
||||
}
|
||||
|
||||
event_long_descs = kmalloc_objs(*event_long_descs, event_idx + 1,
|
||||
GFP_KERNEL);
|
||||
event_long_descs = kmalloc_objs(*event_long_descs, event_idx + 1);
|
||||
if (!event_long_descs) {
|
||||
ret = -ENOMEM;
|
||||
goto e_event_descs;
|
||||
|
||||
@@ -1527,8 +1527,7 @@ static int init_nest_pmu_ref(void)
|
||||
{
|
||||
int nid, i, cpu;
|
||||
|
||||
nest_imc_refc = kzalloc_objs(*nest_imc_refc, num_possible_nodes(),
|
||||
GFP_KERNEL);
|
||||
nest_imc_refc = kzalloc_objs(*nest_imc_refc, num_possible_nodes());
|
||||
|
||||
if (!nest_imc_refc)
|
||||
return -ENOMEM;
|
||||
@@ -1714,14 +1713,12 @@ static int imc_mem_init(struct imc_pmu *pmu_ptr, struct device_node *parent,
|
||||
goto err;
|
||||
|
||||
nr_cores = DIV_ROUND_UP(num_possible_cpus(), threads_per_core);
|
||||
pmu_ptr->mem_info = kzalloc_objs(struct imc_mem_info, nr_cores,
|
||||
GFP_KERNEL);
|
||||
pmu_ptr->mem_info = kzalloc_objs(struct imc_mem_info, nr_cores);
|
||||
|
||||
if (!pmu_ptr->mem_info)
|
||||
goto err;
|
||||
|
||||
core_imc_refc = kzalloc_objs(struct imc_pmu_ref, nr_cores,
|
||||
GFP_KERNEL);
|
||||
core_imc_refc = kzalloc_objs(struct imc_pmu_ref, nr_cores);
|
||||
|
||||
if (!core_imc_refc) {
|
||||
kfree(pmu_ptr->mem_info);
|
||||
@@ -1754,8 +1751,7 @@ static int imc_mem_init(struct imc_pmu *pmu_ptr, struct device_node *parent,
|
||||
return -ENOMEM;
|
||||
|
||||
nr_cores = DIV_ROUND_UP(num_possible_cpus(), threads_per_core);
|
||||
trace_imc_refc = kzalloc_objs(struct imc_pmu_ref, nr_cores,
|
||||
GFP_KERNEL);
|
||||
trace_imc_refc = kzalloc_objs(struct imc_pmu_ref, nr_cores);
|
||||
if (!trace_imc_refc)
|
||||
return -ENOMEM;
|
||||
|
||||
|
||||
@@ -1336,8 +1336,7 @@ static int __init pnv_parse_cpuidle_dt(void)
|
||||
nr_idle_states = of_property_count_u32_elems(np,
|
||||
"ibm,cpu-idle-state-flags");
|
||||
|
||||
pnv_idle_states = kzalloc_objs(*pnv_idle_states, nr_idle_states,
|
||||
GFP_KERNEL);
|
||||
pnv_idle_states = kzalloc_objs(*pnv_idle_states, nr_idle_states);
|
||||
temp_u32 = kcalloc(nr_idle_states, sizeof(u32), GFP_KERNEL);
|
||||
temp_u64 = kcalloc(nr_idle_states, sizeof(u64), GFP_KERNEL);
|
||||
temp_string = kcalloc(nr_idle_states, sizeof(char *), GFP_KERNEL);
|
||||
|
||||
@@ -133,8 +133,7 @@ static int memtrace_init_regions_runtime(u64 size)
|
||||
u32 nid;
|
||||
u64 m;
|
||||
|
||||
memtrace_array = kzalloc_objs(struct memtrace_entry, num_online_nodes(),
|
||||
GFP_KERNEL);
|
||||
memtrace_array = kzalloc_objs(struct memtrace_entry, num_online_nodes());
|
||||
if (!memtrace_array) {
|
||||
pr_err("Failed to allocate memtrace_array\n");
|
||||
return -EINVAL;
|
||||
|
||||
@@ -108,8 +108,7 @@ static int imc_get_mem_addr_nest(struct device_node *node,
|
||||
nr_chips))
|
||||
goto error;
|
||||
|
||||
pmu_ptr->mem_info = kzalloc_objs(*pmu_ptr->mem_info, nr_chips + 1,
|
||||
GFP_KERNEL);
|
||||
pmu_ptr->mem_info = kzalloc_objs(*pmu_ptr->mem_info, nr_chips + 1);
|
||||
if (!pmu_ptr->mem_info)
|
||||
goto error;
|
||||
|
||||
|
||||
@@ -181,13 +181,11 @@ void __init opal_powercap_init(void)
|
||||
has_cur = true;
|
||||
}
|
||||
|
||||
pcaps[i].pattrs = kzalloc_objs(struct powercap_attr, j,
|
||||
GFP_KERNEL);
|
||||
pcaps[i].pattrs = kzalloc_objs(struct powercap_attr, j);
|
||||
if (!pcaps[i].pattrs)
|
||||
goto out_pcaps_pattrs;
|
||||
|
||||
pcaps[i].pg.attrs = kzalloc_objs(struct attribute *, j + 1,
|
||||
GFP_KERNEL);
|
||||
pcaps[i].pg.attrs = kzalloc_objs(struct attribute *, j + 1);
|
||||
if (!pcaps[i].pg.attrs) {
|
||||
kfree(pcaps[i].pattrs);
|
||||
goto out_pcaps_pattrs;
|
||||
|
||||
@@ -132,8 +132,7 @@ void __init opal_psr_init(void)
|
||||
return;
|
||||
}
|
||||
|
||||
psr_attrs = kzalloc_objs(*psr_attrs, of_get_child_count(psr),
|
||||
GFP_KERNEL);
|
||||
psr_attrs = kzalloc_objs(*psr_attrs, of_get_child_count(psr));
|
||||
if (!psr_attrs)
|
||||
goto out_put_psr;
|
||||
|
||||
|
||||
@@ -190,13 +190,11 @@ void __init opal_sensor_groups_init(void)
|
||||
if (!nr_attrs)
|
||||
continue;
|
||||
|
||||
sgs[i].sgattrs = kzalloc_objs(*sgs[i].sgattrs, nr_attrs,
|
||||
GFP_KERNEL);
|
||||
sgs[i].sgattrs = kzalloc_objs(*sgs[i].sgattrs, nr_attrs);
|
||||
if (!sgs[i].sgattrs)
|
||||
goto out_sgs_sgattrs;
|
||||
|
||||
sgs[i].sg.attrs = kzalloc_objs(*sgs[i].sg.attrs, nr_attrs + 1,
|
||||
GFP_KERNEL);
|
||||
sgs[i].sg.attrs = kzalloc_objs(*sgs[i].sg.attrs, nr_attrs + 1);
|
||||
|
||||
if (!sgs[i].sg.attrs) {
|
||||
kfree(sgs[i].sgattrs);
|
||||
|
||||
@@ -1639,8 +1639,7 @@ void __init mpic_init(struct mpic *mpic)
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
/* allocate memory to save mpic state */
|
||||
mpic->save_data = kmalloc_objs(*mpic->save_data, mpic->num_sources,
|
||||
GFP_KERNEL);
|
||||
mpic->save_data = kmalloc_objs(*mpic->save_data, mpic->num_sources);
|
||||
BUG_ON(mpic->save_data == NULL);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -188,8 +188,7 @@ static int mpic_msgr_probe(struct platform_device *dev)
|
||||
dev_info(&dev->dev, "Found %d message registers\n",
|
||||
mpic_msgr_count);
|
||||
|
||||
mpic_msgrs = kzalloc_objs(*mpic_msgrs, mpic_msgr_count,
|
||||
GFP_KERNEL);
|
||||
mpic_msgrs = kzalloc_objs(*mpic_msgrs, mpic_msgr_count);
|
||||
if (!mpic_msgrs) {
|
||||
dev_err(&dev->dev,
|
||||
"No memory for message register blocks\n");
|
||||
|
||||
@@ -55,8 +55,7 @@ static void __init __vdso_init(struct __vdso_info *vdso_info)
|
||||
vdso_info->vdso_code_start) >>
|
||||
PAGE_SHIFT;
|
||||
|
||||
vdso_pagelist = kzalloc_objs(struct page *, vdso_info->vdso_pages,
|
||||
GFP_KERNEL);
|
||||
vdso_pagelist = kzalloc_objs(struct page *, vdso_info->vdso_pages);
|
||||
if (vdso_pagelist == NULL)
|
||||
panic("vDSO kcalloc failed!\n");
|
||||
|
||||
|
||||
+1
-2
@@ -126,8 +126,7 @@ int kvm_s390_pci_aen_init(u8 nisc)
|
||||
return -EPERM;
|
||||
|
||||
mutex_lock(&aift->aift_lock);
|
||||
aift->kzdev = kzalloc_objs(struct kvm_zdev *, ZPCI_NR_DEVICES,
|
||||
GFP_KERNEL);
|
||||
aift->kzdev = kzalloc_objs(struct kvm_zdev *, ZPCI_NR_DEVICES);
|
||||
if (!aift->kzdev) {
|
||||
rc = -ENOMEM;
|
||||
goto unlock;
|
||||
|
||||
+1
-2
@@ -1073,8 +1073,7 @@ static int zpci_mem_init(void)
|
||||
if (!zdev_fmb_cache)
|
||||
goto error_fmb;
|
||||
|
||||
zpci_iomap_start = kzalloc_objs(*zpci_iomap_start, ZPCI_IOMAP_ENTRIES,
|
||||
GFP_KERNEL);
|
||||
zpci_iomap_start = kzalloc_objs(*zpci_iomap_start, ZPCI_IOMAP_ENTRIES);
|
||||
if (!zpci_iomap_start)
|
||||
goto error_iomap;
|
||||
|
||||
|
||||
@@ -558,8 +558,7 @@ static int __init sh7786_pcie_init(void)
|
||||
if (unlikely(nr_ports == 0))
|
||||
return -ENODEV;
|
||||
|
||||
sh7786_pcie_ports = kzalloc_objs(struct sh7786_pcie_port, nr_ports,
|
||||
GFP_KERNEL);
|
||||
sh7786_pcie_ports = kzalloc_objs(struct sh7786_pcie_port, nr_ports);
|
||||
if (unlikely(!sh7786_pcie_ports))
|
||||
return -ENOMEM;
|
||||
|
||||
|
||||
@@ -297,8 +297,7 @@ static void ldom_startcpu_cpuid(unsigned int cpu, unsigned long thread_reg,
|
||||
unsigned long hv_err;
|
||||
int i;
|
||||
|
||||
hdesc = kzalloc_flex(*hdesc, maps, num_kernel_image_mappings,
|
||||
GFP_KERNEL);
|
||||
hdesc = kzalloc_flex(*hdesc, maps, num_kernel_image_mappings);
|
||||
if (!hdesc) {
|
||||
printk(KERN_ERR "ldom_startcpu_cpuid: Cannot allocate "
|
||||
"hvtramp_descr.\n");
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user