提交 f19b1a17 编写于 作者: V Viresh Kumar 提交者: Eduardo Valentin

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: NViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: NEduardo Valentin <edubezval@gmail.com>
上级 d72b4015
...@@ -724,8 +724,9 @@ __cpufreq_cooling_register(struct device_node *np, ...@@ -724,8 +724,9 @@ __cpufreq_cooling_register(struct device_node *np,
/* max_level is an index, not a counter */ /* max_level is an index, not a counter */
cpufreq_cdev->max_level = i - 1; cpufreq_cdev->max_level = i - 1;
cpufreq_cdev->freq_table = kmalloc(sizeof(*cpufreq_cdev->freq_table) * i, cpufreq_cdev->freq_table = kmalloc_array(i,
GFP_KERNEL); sizeof(*cpufreq_cdev->freq_table),
GFP_KERNEL);
if (!cpufreq_cdev->freq_table) { if (!cpufreq_cdev->freq_table) {
cdev = ERR_PTR(-ENOMEM); cdev = ERR_PTR(-ENOMEM);
goto free_idle_time; goto free_idle_time;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册