Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f19b1a17 authored by Viresh Kumar's avatar Viresh Kumar Committed by Eduardo Valentin
Browse files

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: default avatarViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: default avatarEduardo Valentin <edubezval@gmail.com>
parent d72b4015
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -724,7 +724,8 @@ __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,
	cpufreq_cdev->freq_table = kmalloc_array(i,
					sizeof(*cpufreq_cdev->freq_table),
					GFP_KERNEL);
	if (!cpufreq_cdev->freq_table) {
		cdev = ERR_PTR(-ENOMEM);