thermal: cpu_cooling: small memory leak on error
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 16 Dec 2014 23:55:53 +0000 (02:55 +0300)
committerEduardo Valentin <edubezval@gmail.com>
Wed, 17 Dec 2014 12:54:04 +0000 (08:54 -0400)
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>
drivers/thermal/cpu_cooling.c

index 051eb4821bc7da26848762095f96883c8be4575c..9b45f6426f44c010f5542b2de4366b29fd9dbf20 100644 (file)
@@ -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;
        }