Commit 85eb278c authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Juergen Gross

xen/ACPI: Switch to bitmap_zalloc()

Switch to bitmap_zalloc() to show clearly what we are allocating.
Besides that it returns pointer of bitmap type instead of opaque void *.
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: default avatarJuergen Gross <jgross@suse.com>
Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
parent 1d988ed4
...@@ -410,21 +410,21 @@ static int check_acpi_ids(struct acpi_processor *pr_backup) ...@@ -410,21 +410,21 @@ static int check_acpi_ids(struct acpi_processor *pr_backup)
/* All online CPUs have been processed at this stage. Now verify /* All online CPUs have been processed at this stage. Now verify
* whether in fact "online CPUs" == physical CPUs. * whether in fact "online CPUs" == physical CPUs.
*/ */
acpi_id_present = kcalloc(BITS_TO_LONGS(nr_acpi_bits), sizeof(unsigned long), GFP_KERNEL); acpi_id_present = bitmap_zalloc(nr_acpi_bits, GFP_KERNEL);
if (!acpi_id_present) if (!acpi_id_present)
return -ENOMEM; return -ENOMEM;
acpi_id_cst_present = kcalloc(BITS_TO_LONGS(nr_acpi_bits), sizeof(unsigned long), GFP_KERNEL); acpi_id_cst_present = bitmap_zalloc(nr_acpi_bits, GFP_KERNEL);
if (!acpi_id_cst_present) { if (!acpi_id_cst_present) {
kfree(acpi_id_present); bitmap_free(acpi_id_present);
return -ENOMEM; return -ENOMEM;
} }
acpi_psd = kcalloc(nr_acpi_bits, sizeof(struct acpi_psd_package), acpi_psd = kcalloc(nr_acpi_bits, sizeof(struct acpi_psd_package),
GFP_KERNEL); GFP_KERNEL);
if (!acpi_psd) { if (!acpi_psd) {
kfree(acpi_id_present); bitmap_free(acpi_id_present);
kfree(acpi_id_cst_present); bitmap_free(acpi_id_cst_present);
return -ENOMEM; return -ENOMEM;
} }
...@@ -533,14 +533,14 @@ static int __init xen_acpi_processor_init(void) ...@@ -533,14 +533,14 @@ static int __init xen_acpi_processor_init(void)
return -ENODEV; return -ENODEV;
nr_acpi_bits = get_max_acpi_id() + 1; nr_acpi_bits = get_max_acpi_id() + 1;
acpi_ids_done = kcalloc(BITS_TO_LONGS(nr_acpi_bits), sizeof(unsigned long), GFP_KERNEL); acpi_ids_done = bitmap_zalloc(nr_acpi_bits, GFP_KERNEL);
if (!acpi_ids_done) if (!acpi_ids_done)
return -ENOMEM; return -ENOMEM;
acpi_perf_data = alloc_percpu(struct acpi_processor_performance); acpi_perf_data = alloc_percpu(struct acpi_processor_performance);
if (!acpi_perf_data) { if (!acpi_perf_data) {
pr_debug("Memory allocation error for acpi_perf_data\n"); pr_debug("Memory allocation error for acpi_perf_data\n");
kfree(acpi_ids_done); bitmap_free(acpi_ids_done);
return -ENOMEM; return -ENOMEM;
} }
for_each_possible_cpu(i) { for_each_possible_cpu(i) {
...@@ -584,7 +584,7 @@ static int __init xen_acpi_processor_init(void) ...@@ -584,7 +584,7 @@ static int __init xen_acpi_processor_init(void)
err_out: err_out:
/* Freeing a NULL pointer is OK: alloc_percpu zeroes. */ /* Freeing a NULL pointer is OK: alloc_percpu zeroes. */
free_acpi_perf_data(); free_acpi_perf_data();
kfree(acpi_ids_done); bitmap_free(acpi_ids_done);
return rc; return rc;
} }
static void __exit xen_acpi_processor_exit(void) static void __exit xen_acpi_processor_exit(void)
...@@ -592,9 +592,9 @@ static void __exit xen_acpi_processor_exit(void) ...@@ -592,9 +592,9 @@ static void __exit xen_acpi_processor_exit(void)
int i; int i;
unregister_syscore_ops(&xap_syscore_ops); unregister_syscore_ops(&xap_syscore_ops);
kfree(acpi_ids_done); bitmap_free(acpi_ids_done);
kfree(acpi_id_present); bitmap_free(acpi_id_present);
kfree(acpi_id_cst_present); bitmap_free(acpi_id_cst_present);
kfree(acpi_psd); kfree(acpi_psd);
for_each_possible_cpu(i) for_each_possible_cpu(i)
acpi_processor_unregister_performance(i); acpi_processor_unregister_performance(i);
......
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