Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

thermal: intel_powerclamp: Use bitmap_zalloc/bitmap_free when applicable

'cpu_clamping_mask' is a bitmap. So use 'bitmap_zalloc()' and
'bitmap_free()' to simplify code, improve the semantic of the code and
avoid some open-coded arithmetic in allocator arguments.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Christophe JAILLET and committed by
Rafael J. Wysocki
7fc775ff 9e1ff307

+3 -5
+3 -5
drivers/thermal/intel/intel_powerclamp.c
··· 705 705 static int __init powerclamp_init(void) 706 706 { 707 707 int retval; 708 - int bitmap_size; 709 708 710 - bitmap_size = BITS_TO_LONGS(num_possible_cpus()) * sizeof(long); 711 - cpu_clamping_mask = kzalloc(bitmap_size, GFP_KERNEL); 709 + cpu_clamping_mask = bitmap_zalloc(num_possible_cpus(), GFP_KERNEL); 712 710 if (!cpu_clamping_mask) 713 711 return -ENOMEM; 714 712 ··· 751 753 exit_unregister: 752 754 cpuhp_remove_state_nocalls(hp_state); 753 755 exit_free: 754 - kfree(cpu_clamping_mask); 756 + bitmap_free(cpu_clamping_mask); 755 757 return retval; 756 758 } 757 759 module_init(powerclamp_init); ··· 762 764 cpuhp_remove_state_nocalls(hp_state); 763 765 free_percpu(worker_data); 764 766 thermal_cooling_device_unregister(cooling_dev); 765 - kfree(cpu_clamping_mask); 767 + bitmap_free(cpu_clamping_mask); 766 768 767 769 cancel_delayed_work_sync(&poll_pkg_cstate_work); 768 770 debugfs_remove_recursive(debug_dir);