mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] cpufreq: cpu0: Free parent node for error cases
@ 2013-05-01  5:04 Viresh Kumar
  2013-05-02  2:48 ` Shawn Guo
  0 siblings, 1 reply; 3+ messages in thread
From: Viresh Kumar @ 2013-05-01  5:04 UTC (permalink / raw)
  To: rjw
  Cc: linaro-kernel, patches, cpufreq, linux-pm, linux-kernel,
	robin.randhawa, Steve.Bannister, Liviu.Dudau,
	charles.garcia-tobin, arvind.chauhan, shawn.guo, nm,
	Viresh Kumar

We are freeing parent node in success cases but not in failure cases. Lets do
it.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/cpufreq/cpufreq-cpu0.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c
index 3ab8294..c025714 100644
--- a/drivers/cpufreq/cpufreq-cpu0.c
+++ b/drivers/cpufreq/cpufreq-cpu0.c
@@ -189,7 +189,8 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev)
 
 	if (!np) {
 		pr_err("failed to find cpu0 node\n");
-		return -ENOENT;
+		ret = -ENOENT;
+		goto out_put_parent;
 	}
 
 	cpu_dev = &pdev->dev;
@@ -199,7 +200,7 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev)
 	if (IS_ERR(cpu_clk)) {
 		ret = PTR_ERR(cpu_clk);
 		pr_err("failed to get cpu0 clock: %d\n", ret);
-		goto out_put_node;
+		goto out_put_np;
 	}
 
 	cpu_reg = devm_regulator_get(cpu_dev, "cpu0");
@@ -211,13 +212,13 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev)
 	ret = of_init_opp_table(cpu_dev);
 	if (ret) {
 		pr_err("failed to init OPP table: %d\n", ret);
-		goto out_put_node;
+		goto out_put_np;
 	}
 
 	ret = opp_init_cpufreq_table(cpu_dev, &freq_table);
 	if (ret) {
 		pr_err("failed to init cpufreq table: %d\n", ret);
-		goto out_put_node;
+		goto out_put_np;
 	}
 
 	of_property_read_u32(np, "voltage-tolerance", &voltage_tolerance);
@@ -262,8 +263,10 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev)
 
 out_free_table:
 	opp_free_cpufreq_table(cpu_dev, &freq_table);
-out_put_node:
+out_put_np:
 	of_node_put(np);
+out_put_parent:
+	of_node_put(parent);
 	return ret;
 }
 
-- 
1.7.12.rc2.18.g61b472e


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

* Re: [PATCH] cpufreq: cpu0: Free parent node for error cases
  2013-05-01  5:04 [PATCH] cpufreq: cpu0: Free parent node for error cases Viresh Kumar
@ 2013-05-02  2:48 ` Shawn Guo
  2013-05-02 11:58   ` Rafael J. Wysocki
  0 siblings, 1 reply; 3+ messages in thread
From: Shawn Guo @ 2013-05-02  2:48 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: rjw, linaro-kernel, patches, cpufreq, linux-pm, linux-kernel,
	robin.randhawa, Steve.Bannister, Liviu.Dudau,
	charles.garcia-tobin, arvind.chauhan, nm

On Wed, May 01, 2013 at 10:34:43AM +0530, Viresh Kumar wrote:
> We are freeing parent node in success cases but not in failure cases. Lets do
> it.
> 
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
>  drivers/cpufreq/cpufreq-cpu0.c | 13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c
> index 3ab8294..c025714 100644
> --- a/drivers/cpufreq/cpufreq-cpu0.c
> +++ b/drivers/cpufreq/cpufreq-cpu0.c
> @@ -189,7 +189,8 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev)
>  
>  	if (!np) {
>  		pr_err("failed to find cpu0 node\n");
> -		return -ENOENT;
> +		ret = -ENOENT;
> +		goto out_put_parent;
>  	}
>  
>  	cpu_dev = &pdev->dev;
> @@ -199,7 +200,7 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev)
>  	if (IS_ERR(cpu_clk)) {
>  		ret = PTR_ERR(cpu_clk);
>  		pr_err("failed to get cpu0 clock: %d\n", ret);
> -		goto out_put_node;
> +		goto out_put_np;
>  	}
>  
>  	cpu_reg = devm_regulator_get(cpu_dev, "cpu0");
> @@ -211,13 +212,13 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev)
>  	ret = of_init_opp_table(cpu_dev);
>  	if (ret) {
>  		pr_err("failed to init OPP table: %d\n", ret);
> -		goto out_put_node;
> +		goto out_put_np;
>  	}
>  
>  	ret = opp_init_cpufreq_table(cpu_dev, &freq_table);
>  	if (ret) {
>  		pr_err("failed to init cpufreq table: %d\n", ret);
> -		goto out_put_node;
> +		goto out_put_np;
>  	}
>  
>  	of_property_read_u32(np, "voltage-tolerance", &voltage_tolerance);
> @@ -262,8 +263,10 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev)
>  
>  out_free_table:
>  	opp_free_cpufreq_table(cpu_dev, &freq_table);
> -out_put_node:
> +out_put_np:

Unnecessary renaming brings unnecessary diffstat?

Shawn

>  	of_node_put(np);
> +out_put_parent:
> +	of_node_put(parent);
>  	return ret;
>  }
>  
> -- 
> 1.7.12.rc2.18.g61b472e
> 


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

* Re: [PATCH] cpufreq: cpu0: Free parent node for error cases
  2013-05-02  2:48 ` Shawn Guo
@ 2013-05-02 11:58   ` Rafael J. Wysocki
  0 siblings, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2013-05-02 11:58 UTC (permalink / raw)
  To: Shawn Guo
  Cc: Viresh Kumar, linaro-kernel, patches, cpufreq, linux-pm,
	linux-kernel, robin.randhawa, Steve.Bannister, Liviu.Dudau,
	charles.garcia-tobin, arvind.chauhan, nm

On Thursday, May 02, 2013 10:48:50 AM Shawn Guo wrote:
> On Wed, May 01, 2013 at 10:34:43AM +0530, Viresh Kumar wrote:
> > We are freeing parent node in success cases but not in failure cases. Lets do
> > it.
> > 
> > Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> > ---
> >  drivers/cpufreq/cpufreq-cpu0.c | 13 ++++++++-----
> >  1 file changed, 8 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c
> > index 3ab8294..c025714 100644
> > --- a/drivers/cpufreq/cpufreq-cpu0.c
> > +++ b/drivers/cpufreq/cpufreq-cpu0.c
> > @@ -189,7 +189,8 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev)
> >  
> >  	if (!np) {
> >  		pr_err("failed to find cpu0 node\n");
> > -		return -ENOENT;
> > +		ret = -ENOENT;
> > +		goto out_put_parent;
> >  	}
> >  
> >  	cpu_dev = &pdev->dev;
> > @@ -199,7 +200,7 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev)
> >  	if (IS_ERR(cpu_clk)) {
> >  		ret = PTR_ERR(cpu_clk);
> >  		pr_err("failed to get cpu0 clock: %d\n", ret);
> > -		goto out_put_node;
> > +		goto out_put_np;
> >  	}
> >  
> >  	cpu_reg = devm_regulator_get(cpu_dev, "cpu0");
> > @@ -211,13 +212,13 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev)
> >  	ret = of_init_opp_table(cpu_dev);
> >  	if (ret) {
> >  		pr_err("failed to init OPP table: %d\n", ret);
> > -		goto out_put_node;
> > +		goto out_put_np;
> >  	}
> >  
> >  	ret = opp_init_cpufreq_table(cpu_dev, &freq_table);
> >  	if (ret) {
> >  		pr_err("failed to init cpufreq table: %d\n", ret);
> > -		goto out_put_node;
> > +		goto out_put_np;
> >  	}
> >  
> >  	of_property_read_u32(np, "voltage-tolerance", &voltage_tolerance);
> > @@ -262,8 +263,10 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev)
> >  
> >  out_free_table:
> >  	opp_free_cpufreq_table(cpu_dev, &freq_table);
> > -out_put_node:
> > +out_put_np:
> 
> Unnecessary renaming brings unnecessary diffstat?

Yeah, I'd prefer only changes that are essential here.

Thanks,
Rafael


-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

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

end of thread, other threads:[~2013-05-02 11:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-01  5:04 [PATCH] cpufreq: cpu0: Free parent node for error cases Viresh Kumar
2013-05-02  2:48 ` Shawn Guo
2013-05-02 11:58   ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®