diff options
author | Viresh Kumar <viresh.kumar@linaro.org> | 2017-05-23 12:33:06 +0530 |
---|---|---|
committer | Eduardo Valentin <edubezval@gmail.com> | 2017-05-27 17:33:04 -0700 |
commit | f19b1a1735f7453c35031ed5ca3883f20176dde6 (patch) | |
tree | 3348826afcc73055ae91cf3b2cb2db2828c485c3 /drivers/thermal/cpu_cooling.c | |
parent | d72b4015839cca333a8e0108b1739a50f03d2acc (diff) |
thermal: cpu_cooling: Replace kmalloc with kmalloc_array
Checkpatch reports following:
WARNING: Prefer kmalloc_array over kmalloc with multiply
+ cpufreq_cdev->freq_table = kmalloc(sizeof(*cpufreq_cdev->freq_table) * i,
Fix that.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
Diffstat (limited to 'drivers/thermal/cpu_cooling.c')
-rw-r--r-- | drivers/thermal/cpu_cooling.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index 1305020790b2..908a8014cf76 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c @@ -724,8 +724,9 @@ __cpufreq_cooling_register(struct device_node *np, /* max_level is an index, not a counter */ cpufreq_cdev->max_level = i - 1; - cpufreq_cdev->freq_table = kmalloc(sizeof(*cpufreq_cdev->freq_table) * i, - GFP_KERNEL); + cpufreq_cdev->freq_table = kmalloc_array(i, + sizeof(*cpufreq_cdev->freq_table), + GFP_KERNEL); if (!cpufreq_cdev->freq_table) { cdev = ERR_PTR(-ENOMEM); goto free_idle_time; |