thermal: cpu_cooling: small memory leak on error
Subsystems (2)
PATCH 1/1 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.
Signed-off-by Dan Carpenter <[email protected]>
drivers/thermal/cpu_cooling.c +0 -1
@@ -347,7 +347,6 @@ __cpufreq_cooling_register(struct device_node *np, cpufreq_dev->freq_table =kmalloc (sizeof (*cpufreq_dev->freq_table) * cpufreq_dev->max_level,GFP_KERNEL );if (!cpufreq_dev->freq_table) { -return ERR_PTR (-ENOMEM ); cool_dev =ERR_PTR (-ENOMEM ); goto free_cdev; }
Quoted 7 lines · Dan Carpenter
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.Signed-off-by Dan Carpenter <[email protected]>
Fixes f6859014c7e7 ("thermal: cpu_cooling: Store frequencies in
descending order")
drivers/thermal/cpu_cooling.c __cpufreq_cooling_register(struct device_node *np, · line 352
Quoted 13 lines
drivers/thermal/cpu_cooling.c +0
-1@@ -347,7 +347,6 @@ __cpufreq_cooling_register(struct device_node *np, cpufreq_dev->freq_table =kmalloc (sizeof (*cpufreq_dev->freq_table) * cpufreq_dev->max_level,GFP_KERNEL );if (!cpufreq_dev->freq_table) { -return ERR_PTR (-ENOMEM ); cool_dev =ERR_PTR (-ENOMEM ); goto free_cdev; }
Acked-by Viresh Kumar <[email protected]>