Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

thermal: cpu_cooling: small memory leak on error

There was a left over return here so the error handling isn't run.
It leads to a small memory leak and a static checker warning.

drivers/thermal/cpu_cooling.c:351 __cpufreq_cooling_register()
info: ignoring unreachable code.

Fixes: f6859014c7e7 ("thermal: cpu_cooling: Store frequencies in descending order")
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>

authored by

Dan Carpenter and committed by
Eduardo Valentin
2d2e95ea cffafc32

-1
-1
drivers/thermal/cpu_cooling.c
··· 347 347 cpufreq_dev->freq_table = kmalloc(sizeof(*cpufreq_dev->freq_table) * 348 348 cpufreq_dev->max_level, GFP_KERNEL); 349 349 if (!cpufreq_dev->freq_table) { 350 - return ERR_PTR(-ENOMEM); 351 350 cool_dev = ERR_PTR(-ENOMEM); 352 351 goto free_cdev; 353 352 }