2013-05-03 04:44:36

by Viresh Kumar

[permalink] [raw]
Subject: [PATCH V2] cpufreq: cpu0: Free parent node for error cases

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

Signed-off-by: Viresh Kumar <[email protected]>
---
drivers/cpufreq/cpufreq-cpu0.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c
index 3ab8294..8565d41 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;
@@ -264,6 +265,8 @@ out_free_table:
opp_free_cpufreq_table(cpu_dev, &freq_table);
out_put_node:
of_node_put(np);
+out_put_parent:
+ of_node_put(parent);
return ret;
}

--
1.7.12.rc2.18.g61b472e


2013-05-03 06:03:41

by Shawn Guo

[permalink] [raw]
Subject: Re: [PATCH V2] cpufreq: cpu0: Free parent node for error cases

On Fri, May 03, 2013 at 10:14:25AM +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 <[email protected]>

Acked-by: Shawn Guo <[email protected]>

> ---
> drivers/cpufreq/cpufreq-cpu0.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c
> index 3ab8294..8565d41 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;
> @@ -264,6 +265,8 @@ out_free_table:
> opp_free_cpufreq_table(cpu_dev, &freq_table);
> out_put_node:
> of_node_put(np);
> +out_put_parent:
> + of_node_put(parent);
> return ret;
> }
>
> --
> 1.7.12.rc2.18.g61b472e
>

2013-05-03 12:39:41

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [PATCH V2] cpufreq: cpu0: Free parent node for error cases

On Friday, May 03, 2013 02:03:29 PM Shawn Guo wrote:
> On Fri, May 03, 2013 at 10:14:25AM +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 <[email protected]>
>
> Acked-by: Shawn Guo <[email protected]>

OK, queued up for the v3.10-rc2 push.

Thanks,
Rafael


> > ---
> > drivers/cpufreq/cpufreq-cpu0.c | 5 ++++-
> > 1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c
> > index 3ab8294..8565d41 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;
> > @@ -264,6 +265,8 @@ out_free_table:
> > opp_free_cpufreq_table(cpu_dev, &freq_table);
> > out_put_node:
> > of_node_put(np);
> > +out_put_parent:
> > + of_node_put(parent);
> > return ret;
> > }
> >
>
> --
> To unsubscribe from this list: send the line "unsubscribe cpufreq" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.