public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Viresh Kumar <viresh.kumar@linaro.org>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: rjw@rjwysocki.net, linux-pm@vger.kernel.org,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] cpufreq: ti: Fix 'of_node_put' being called twice in error handling path
Date: Sun, 20 Aug 2017 18:51:06 +0530	[thread overview]
Message-ID: <20170820132106.GA21417@ubuntu> (raw)
In-Reply-To: <20170819202246.18415-1-christophe.jaillet@wanadoo.fr>

On 19-08-17, 22:22, Christophe JAILLET wrote:
> If 'dev_pm_opp_set_supported_hw()' fails, 'opp_data->opp_node' refcount
> will be decremented 2 times.
> One, just a few lines above, and another one in the error handling path.
> 
> Fix it by simply moving the 'of_node_put' call of the normal path.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
>  drivers/cpufreq/ti-cpufreq.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/cpufreq/ti-cpufreq.c b/drivers/cpufreq/ti-cpufreq.c
> index a7b5658c0460..b29cd3398463 100644
> --- a/drivers/cpufreq/ti-cpufreq.c
> +++ b/drivers/cpufreq/ti-cpufreq.c
> @@ -245,8 +245,6 @@ static int ti_cpufreq_init(void)
>  	if (ret)
>  		goto fail_put_node;
>  
> -	of_node_put(opp_data->opp_node);
> -
>  	ret = PTR_ERR_OR_ZERO(dev_pm_opp_set_supported_hw(opp_data->cpu_dev,
>  							  version, VERSION_COUNT));
>  	if (ret) {
> @@ -255,6 +253,8 @@ static int ti_cpufreq_init(void)
>  		goto fail_put_node;
>  	}
>  
> +	of_node_put(opp_data->opp_node);
> +
>  register_cpufreq_dt:
>  	platform_device_register_simple("cpufreq-dt", -1, NULL, 0);

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

-- 
viresh

  reply	other threads:[~2017-08-20 13:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-19 20:22 [PATCH] cpufreq: ti: Fix 'of_node_put' being called twice in error handling path Christophe JAILLET
2017-08-20 13:21 ` Viresh Kumar [this message]
2017-08-28 21:21   ` Rafael J. Wysocki

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=20170820132106.GA21417@ubuntu \
    --to=viresh.kumar@linaro.org \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    /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