diff options
author | Viresh Kumar <viresh.kumar@linaro.org> | 2017-05-23 09:03:06 +0200 |
---|---|---|
committer | Eduardo Valentin <edubezval@gmail.com> | 2017-05-28 02:33:04 +0200 |
commit | f19b1a1735f7453c35031ed5ca3883f20176dde6 (patch) | |
tree | 3348826afcc73055ae91cf3b2cb2db2828c485c3 /drivers/thermal | |
parent | thermal: cpu_cooling: Rearrange struct cpufreq_cooling_device (diff) | |
download | linux-f19b1a1735f7453c35031ed5ca3883f20176dde6.tar.xz linux-f19b1a1735f7453c35031ed5ca3883f20176dde6.zip |
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')
-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; |