Linux Power Management development
 help / color / mirror / Atom feed
From: Zhang Rui <rui.zhang@intel.com>
To: Durgadoss R <durgadoss.r@intel.com>
Cc: eduardo.valentin@ti.com, linux-pm@vger.kernel.org,
	jacob.jun.pan@linux.intel.com
Subject: Re: [PATCH] Thermal: Tidy up error handling in powerclamp_init
Date: Wed, 09 Oct 2013 12:18:47 +0800	[thread overview]
Message-ID: <1381292327.2133.39.camel@rzhang1-mobl4> (raw)
In-Reply-To: <1380903804-18913-1-git-send-email-durgadoss.r@intel.com>

On Fri, 2013-10-04 at 21:53 +0530, Durgadoss R wrote:
> This patch
>  * adds missing kfree() for cpu_clamping_mask
>  * adds return value checking for alloc_percpu()
>  * unregister hotcpu notifier in exit path
> 
> Signed-off-by: Durgadoss R <durgadoss.r@intel.com>

applied to thermal -next.

thanks,
rui

> ---
>  drivers/thermal/intel_powerclamp.c |   24 +++++++++++++++++++++---
>  1 file changed, 21 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/thermal/intel_powerclamp.c b/drivers/thermal/intel_powerclamp.c
> index b40b37c..a7cd170 100644
> --- a/drivers/thermal/intel_powerclamp.c
> +++ b/drivers/thermal/intel_powerclamp.c
> @@ -758,21 +758,39 @@ static int powerclamp_init(void)
>  	/* probe cpu features and ids here */
>  	retval = powerclamp_probe();
>  	if (retval)
> -		return retval;
> +		goto exit_free;
> +
>  	/* set default limit, maybe adjusted during runtime based on feedback */
>  	window_size = 2;
>  	register_hotcpu_notifier(&powerclamp_cpu_notifier);
> +
>  	powerclamp_thread = alloc_percpu(struct task_struct *);
> +	if (!powerclamp_thread) {
> +		retval = -ENOMEM;
> +		goto exit_unregister;
> +	}
> +
>  	cooling_dev = thermal_cooling_device_register("intel_powerclamp", NULL,
>  						&powerclamp_cooling_ops);
> -	if (IS_ERR(cooling_dev))
> -		return -ENODEV;
> +	if (IS_ERR(cooling_dev)) {
> +		retval = -ENODEV;
> +		goto exit_free_thread;
> +	}
>  
>  	if (!duration)
>  		duration = jiffies_to_msecs(DEFAULT_DURATION_JIFFIES);
> +
>  	powerclamp_create_debug_files();
>  
>  	return 0;
> +
> +exit_free_thread:
> +	free_percpu(powerclamp_thread);
> +exit_unregister:
> +	unregister_hotcpu_notifier(&powerclamp_cpu_notifier);
> +exit_free:
> +	kfree(cpu_clamping_mask);
> +	return retval;
>  }
>  module_init(powerclamp_init);
>  



      parent reply	other threads:[~2013-10-09  4:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-04 16:23 [PATCH] Thermal: Tidy up error handling in powerclamp_init Durgadoss R
2013-10-04 16:37 ` Jacob Pan
2013-10-09  4:18 ` Zhang Rui [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1381292327.2133.39.camel@rzhang1-mobl4 \
    --to=rui.zhang@intel.com \
    --cc=durgadoss.r@intel.com \
    --cc=eduardo.valentin@ti.com \
    --cc=jacob.jun.pan@linux.intel.com \
    --cc=linux-pm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox