Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1715757 > unrolled thread

[PATCH] cpufreq: ti: Fix 'of_node_put' being called twice in error handling path

Started byChristophe JAILLET <christophe.jaillet@wanadoo.fr>
First post2017-08-19 22:30 +0200
Last post2017-08-20 15:30 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] cpufreq: ti: Fix 'of_node_put' being called twice in error handling path Christophe JAILLET <christophe.jaillet@wanadoo.fr> - 2017-08-19 22:30 +0200
    Re: [PATCH] cpufreq: ti: Fix 'of_node_put' being called twice in  error handling path Viresh Kumar <viresh.kumar@linaro.org> - 2017-08-20 15:30 +0200

#1715757 — [PATCH] cpufreq: ti: Fix 'of_node_put' being called twice in error handling path

FromChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Date2017-08-19 22:30 +0200
Subject[PATCH] cpufreq: ti: Fix 'of_node_put' being called twice in error handling path
Message-ID<ugixz-5RV-1@gated-at.bofh.it>
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);
 
-- 
2.11.0

[toc] | [next] | [standalone]


#1715937 — Re: [PATCH] cpufreq: ti: Fix 'of_node_put' being called twice in error handling path

FromViresh Kumar <viresh.kumar@linaro.org>
Date2017-08-20 15:30 +0200
SubjectRe: [PATCH] cpufreq: ti: Fix 'of_node_put' being called twice in error handling path
Message-ID<ugysG-7yX-9@gated-at.bofh.it>
In reply to#1715757
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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web