linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] thermal: cpu_cooling: small memory leak on error
@ 2014-12-16 23:55 Dan Carpenter
  2014-12-17  5:26 ` Viresh Kumar
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2014-12-16 23:55 UTC (permalink / raw)
  To: Zhang Rui; +Cc: Eduardo Valentin, linux-pm, kernel-janitors

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 <dan.carpenter@oracle.com>

diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c
index 051eb48..9b45f64 100644
--- a/drivers/thermal/cpu_cooling.c
+++ b/drivers/thermal/cpu_cooling.c
@@ -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;
 	}

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch] thermal: cpu_cooling: small memory leak on error
  2014-12-16 23:55 [patch] thermal: cpu_cooling: small memory leak on error Dan Carpenter
@ 2014-12-17  5:26 ` Viresh Kumar
  0 siblings, 0 replies; 2+ messages in thread
From: Viresh Kumar @ 2014-12-17  5:26 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Zhang Rui, Eduardo Valentin, Linux PM list, kernel-janitors

On Wed, Dec 17, 2014 at 5:25 AM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> 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 <dan.carpenter@oracle.com>

Fixes: f6859014c7e7 ("thermal: cpu_cooling: Store frequencies in
descending order")

>
> diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c
> index 051eb48..9b45f64 100644
> --- a/drivers/thermal/cpu_cooling.c
> +++ b/drivers/thermal/cpu_cooling.c
> @@ -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 <viresh.kumar@linaro.org>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-12-17  5:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-16 23:55 [patch] thermal: cpu_cooling: small memory leak on error Dan Carpenter
2014-12-17  5:26 ` Viresh Kumar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).