Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1647695
| From | Viresh Kumar <viresh.kumar@linaro.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH] thermal: cpu_cooling: Replace kmalloc with kmalloc_array |
| Date | 2017-05-23 09:10 +0200 |
| Message-ID | <tKc78-8iP-9@gated-at.bofh.it> (permalink) |
| References | <tKbE5-7Qs-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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>
---
drivers/thermal/cpu_cooling.c | 5 +++--
1 file 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;
--
2.13.0.70.g6367777092d9
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: [PATCH V4 03/17] thermal: cpu_cooling: Name cpufreq cooling devices as cpufreq_cdev Zhang Rui <rui.zhang@intel.com> - 2017-05-23 08:40 +0200
[PATCH] thermal: cpu_cooling: Replace kmalloc with kmalloc_array Viresh Kumar <viresh.kumar@linaro.org> - 2017-05-23 09:10 +0200
Re: [PATCH] thermal: cpu_cooling: Replace kmalloc with kmalloc_array Eduardo Valentin <edubezval@gmail.com> - 2017-05-24 04:30 +0200
Re: [PATCH] thermal: cpu_cooling: Replace kmalloc with kmalloc_array Viresh Kumar <viresh.kumar@linaro.org> - 2017-05-24 06:00 +0200
Re: [PATCH V4 03/17] thermal: cpu_cooling: Name cpufreq cooling devices as cpufreq_cdev Viresh Kumar <viresh.kumar@linaro.org> - 2017-05-23 09:10 +0200
csiph-web