summaryrefslogtreecommitdiffstats
path: root/drivers/xen
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2019-03-04 04:31:27 -0500
committerJuergen Gross <jgross@suse.com>2019-03-04 09:04:39 -0500
commit85eb278c1899f78d1429b45ffa84039d9011cb55 (patch)
tree8a67c042179b1a9d0b1fdc25691c24c7d7c69a14 /drivers/xen
parent1d988ed46543ca36c010634c97ac32114362ddb1 (diff)
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: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Juergen Gross <jgross@suse.com> Signed-off-by: Juergen Gross <jgross@suse.com>
Diffstat (limited to 'drivers/xen')
-rw-r--r--drivers/xen/xen-acpi-processor.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/drivers/xen/xen-acpi-processor.c b/drivers/xen/xen-acpi-processor.c
index fbb9137c7d02..98e35644fda7 100644
--- a/drivers/xen/xen-acpi-processor.c
+++ b/drivers/xen/xen-acpi-processor.c
@@ -410,21 +410,21 @@ static int check_acpi_ids(struct acpi_processor *pr_backup)
410 /* All online CPUs have been processed at this stage. Now verify 410 /* All online CPUs have been processed at this stage. Now verify
411 * whether in fact "online CPUs" == physical CPUs. 411 * whether in fact "online CPUs" == physical CPUs.
412 */ 412 */
413 acpi_id_present = kcalloc(BITS_TO_LONGS(nr_acpi_bits), sizeof(unsigned long), GFP_KERNEL); 413 acpi_id_present = bitmap_zalloc(nr_acpi_bits, GFP_KERNEL);
414 if (!acpi_id_present) 414 if (!acpi_id_present)
415 return -ENOMEM; 415 return -ENOMEM;
416 416
417 acpi_id_cst_present = kcalloc(BITS_TO_LONGS(nr_acpi_bits), sizeof(unsigned long), GFP_KERNEL); 417 acpi_id_cst_present = bitmap_zalloc(nr_acpi_bits, GFP_KERNEL);
418 if (!acpi_id_cst_present) { 418 if (!acpi_id_cst_present) {
419 kfree(acpi_id_present); 419 bitmap_free(acpi_id_present);
420 return -ENOMEM; 420 return -ENOMEM;
421 } 421 }
422 422
423 acpi_psd = kcalloc(nr_acpi_bits, sizeof(struct acpi_psd_package), 423 acpi_psd = kcalloc(nr_acpi_bits, sizeof(struct acpi_psd_package),
424 GFP_KERNEL); 424 GFP_KERNEL);
425 if (!acpi_psd) { 425 if (!acpi_psd) {
426 kfree(acpi_id_present); 426 bitmap_free(acpi_id_present);
427 kfree(acpi_id_cst_present); 427 bitmap_free(acpi_id_cst_present);
428 return -ENOMEM; 428 return -ENOMEM;
429 } 429 }
430 430
@@ -533,14 +533,14 @@ static int __init xen_acpi_processor_init(void)
533 return -ENODEV; 533 return -ENODEV;
534 534
535 nr_acpi_bits = get_max_acpi_id() + 1; 535 nr_acpi_bits = get_max_acpi_id() + 1;
536 acpi_ids_done = kcalloc(BITS_TO_LONGS(nr_acpi_bits), sizeof(unsigned long), GFP_KERNEL); 536 acpi_ids_done = bitmap_zalloc(nr_acpi_bits, GFP_KERNEL);
537 if (!acpi_ids_done) 537 if (!acpi_ids_done)
538 return -ENOMEM; 538 return -ENOMEM;
539 539
540 acpi_perf_data = alloc_percpu(struct acpi_processor_performance); 540 acpi_perf_data = alloc_percpu(struct acpi_processor_performance);
541 if (!acpi_perf_data) { 541 if (!acpi_perf_data) {
542 pr_debug("Memory allocation error for acpi_perf_data\n"); 542 pr_debug("Memory allocation error for acpi_perf_data\n");
543 kfree(acpi_ids_done); 543 bitmap_free(acpi_ids_done);
544 return -ENOMEM; 544 return -ENOMEM;
545 } 545 }
546 for_each_possible_cpu(i) { 546 for_each_possible_cpu(i) {
@@ -584,7 +584,7 @@ err_unregister:
584err_out: 584err_out:
585 /* Freeing a NULL pointer is OK: alloc_percpu zeroes. */ 585 /* Freeing a NULL pointer is OK: alloc_percpu zeroes. */
586 free_acpi_perf_data(); 586 free_acpi_perf_data();
587 kfree(acpi_ids_done); 587 bitmap_free(acpi_ids_done);
588 return rc; 588 return rc;
589} 589}
590static void __exit xen_acpi_processor_exit(void) 590static void __exit xen_acpi_processor_exit(void)
@@ -592,9 +592,9 @@ static void __exit xen_acpi_processor_exit(void)
592 int i; 592 int i;
593 593
594 unregister_syscore_ops(&xap_syscore_ops); 594 unregister_syscore_ops(&xap_syscore_ops);
595 kfree(acpi_ids_done); 595 bitmap_free(acpi_ids_done);
596 kfree(acpi_id_present); 596 bitmap_free(acpi_id_present);
597 kfree(acpi_id_cst_present); 597 bitmap_free(acpi_id_cst_present);
598 kfree(acpi_psd); 598 kfree(acpi_psd);
599 for_each_possible_cpu(i) 599 for_each_possible_cpu(i)
600 acpi_processor_unregister_performance(i); 600 acpi_processor_unregister_performance(i);