Commit eaa95840 authored by Yinghai Lu's avatar Yinghai Lu Committed by Rusty Russell

cpumask: alloc zeroed cpumask for static cpumask_var_ts

These are defined as static cpumask_var_t so if MAXSMP is not used,
they are cleared already.  Avoid surprises when MAXSMP is enabled.
Signed-off-by: default avatarYinghai Lu <yinghai.lu@kernel.org>
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
parent 0281b5dc
...@@ -550,7 +550,7 @@ static int __init acpi_cpufreq_early_init(void) ...@@ -550,7 +550,7 @@ static int __init acpi_cpufreq_early_init(void)
return -ENOMEM; return -ENOMEM;
} }
for_each_possible_cpu(i) { for_each_possible_cpu(i) {
if (!alloc_cpumask_var_node( if (!zalloc_cpumask_var_node(
&per_cpu_ptr(acpi_perf_data, i)->shared_cpu_map, &per_cpu_ptr(acpi_perf_data, i)->shared_cpu_map,
GFP_KERNEL, cpu_to_node(i))) { GFP_KERNEL, cpu_to_node(i))) {
......
...@@ -322,7 +322,7 @@ static int powernow_acpi_init(void) ...@@ -322,7 +322,7 @@ static int powernow_acpi_init(void)
goto err0; goto err0;
} }
if (!alloc_cpumask_var(&acpi_processor_perf->shared_cpu_map, if (!zalloc_cpumask_var(&acpi_processor_perf->shared_cpu_map,
GFP_KERNEL)) { GFP_KERNEL)) {
retval = -ENOMEM; retval = -ENOMEM;
goto err05; goto err05;
......
...@@ -887,7 +887,7 @@ static int powernow_k8_cpu_init_acpi(struct powernow_k8_data *data) ...@@ -887,7 +887,7 @@ static int powernow_k8_cpu_init_acpi(struct powernow_k8_data *data)
/* notify BIOS that we exist */ /* notify BIOS that we exist */
acpi_processor_notify_smm(THIS_MODULE); acpi_processor_notify_smm(THIS_MODULE);
if (!alloc_cpumask_var(&data->acpi_data.shared_cpu_map, GFP_KERNEL)) { if (!zalloc_cpumask_var(&data->acpi_data.shared_cpu_map, GFP_KERNEL)) {
printk(KERN_ERR PFX printk(KERN_ERR PFX
"unable to alloc powernow_k8_data cpumask\n"); "unable to alloc powernow_k8_data cpumask\n");
ret_val = -ENOMEM; ret_val = -ENOMEM;
......
...@@ -471,7 +471,7 @@ static int centrino_target (struct cpufreq_policy *policy, ...@@ -471,7 +471,7 @@ static int centrino_target (struct cpufreq_policy *policy,
if (unlikely(!alloc_cpumask_var(&saved_mask, GFP_KERNEL))) if (unlikely(!alloc_cpumask_var(&saved_mask, GFP_KERNEL)))
return -ENOMEM; return -ENOMEM;
if (unlikely(!alloc_cpumask_var(&covered_cpus, GFP_KERNEL))) { if (unlikely(!zalloc_cpumask_var(&covered_cpus, GFP_KERNEL))) {
free_cpumask_var(saved_mask); free_cpumask_var(saved_mask);
return -ENOMEM; return -ENOMEM;
} }
......
...@@ -1163,7 +1163,7 @@ static __init int mce_init_device(void) ...@@ -1163,7 +1163,7 @@ static __init int mce_init_device(void)
if (!mce_available(&boot_cpu_data)) if (!mce_available(&boot_cpu_data))
return -EIO; return -EIO;
alloc_cpumask_var(&mce_device_initialized, GFP_KERNEL); zalloc_cpumask_var(&mce_device_initialized, GFP_KERNEL);
err = mce_init_banks(); err = mce_init_banks();
if (err) if (err)
......
...@@ -832,7 +832,7 @@ static int __init uv_bau_init(void) ...@@ -832,7 +832,7 @@ static int __init uv_bau_init(void)
return 0; return 0;
for_each_possible_cpu(cur_cpu) for_each_possible_cpu(cur_cpu)
alloc_cpumask_var_node(&per_cpu(uv_flush_tlb_mask, cur_cpu), zalloc_cpumask_var_node(&per_cpu(uv_flush_tlb_mask, cur_cpu),
GFP_KERNEL, cpu_to_node(cur_cpu)); GFP_KERNEL, cpu_to_node(cur_cpu));
uv_bau_retry_limit = 1; uv_bau_retry_limit = 1;
......
...@@ -844,7 +844,7 @@ static int acpi_processor_add(struct acpi_device *device) ...@@ -844,7 +844,7 @@ static int acpi_processor_add(struct acpi_device *device)
if (!pr) if (!pr)
return -ENOMEM; return -ENOMEM;
if (!alloc_cpumask_var(&pr->throttling.shared_cpu_map, GFP_KERNEL)) { if (!zalloc_cpumask_var(&pr->throttling.shared_cpu_map, GFP_KERNEL)) {
kfree(pr); kfree(pr);
return -ENOMEM; return -ENOMEM;
} }
......
...@@ -808,7 +808,7 @@ static int cpufreq_add_dev(struct sys_device *sys_dev) ...@@ -808,7 +808,7 @@ static int cpufreq_add_dev(struct sys_device *sys_dev)
ret = -ENOMEM; ret = -ENOMEM;
goto nomem_out; goto nomem_out;
} }
if (!alloc_cpumask_var(&policy->related_cpus, GFP_KERNEL)) { if (!zalloc_cpumask_var(&policy->related_cpus, GFP_KERNEL)) {
free_cpumask_var(policy->cpus); free_cpumask_var(policy->cpus);
kfree(policy); kfree(policy);
ret = -ENOMEM; ret = -ENOMEM;
......
...@@ -165,7 +165,7 @@ int __init_refok cpupri_init(struct cpupri *cp, bool bootmem) ...@@ -165,7 +165,7 @@ int __init_refok cpupri_init(struct cpupri *cp, bool bootmem)
vec->count = 0; vec->count = 0;
if (bootmem) if (bootmem)
alloc_bootmem_cpumask_var(&vec->mask); alloc_bootmem_cpumask_var(&vec->mask);
else if (!alloc_cpumask_var(&vec->mask, GFP_KERNEL)) else if (!zalloc_cpumask_var(&vec->mask, GFP_KERNEL))
goto cleanup; goto cleanup;
} }
......
...@@ -1591,7 +1591,7 @@ static inline void init_sched_rt_class(void) ...@@ -1591,7 +1591,7 @@ static inline void init_sched_rt_class(void)
unsigned int i; unsigned int i;
for_each_possible_cpu(i) for_each_possible_cpu(i)
alloc_cpumask_var_node(&per_cpu(local_cpu_mask, i), zalloc_cpumask_var_node(&per_cpu(local_cpu_mask, i),
GFP_KERNEL, cpu_to_node(i)); GFP_KERNEL, cpu_to_node(i));
} }
#endif /* CONFIG_SMP */ #endif /* CONFIG_SMP */
......
...@@ -52,7 +52,7 @@ hotplug_cfd(struct notifier_block *nfb, unsigned long action, void *hcpu) ...@@ -52,7 +52,7 @@ hotplug_cfd(struct notifier_block *nfb, unsigned long action, void *hcpu)
switch (action) { switch (action) {
case CPU_UP_PREPARE: case CPU_UP_PREPARE:
case CPU_UP_PREPARE_FROZEN: case CPU_UP_PREPARE_FROZEN:
if (!alloc_cpumask_var_node(&cfd->cpumask, GFP_KERNEL, if (!zalloc_cpumask_var_node(&cfd->cpumask, GFP_KERNEL,
cpu_to_node(cpu))) cpu_to_node(cpu)))
return NOTIFY_BAD; return NOTIFY_BAD;
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment