All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cpufreq: tegra124: add missing of_node_put()
@ 2019-02-04  6:35 Yangtao Li
  2019-02-04  6:36 ` Viresh Kumar
  2019-02-04  7:28 ` Thierry Reding
  0 siblings, 2 replies; 6+ messages in thread
From: Yangtao Li @ 2019-02-04  6:35 UTC (permalink / raw)
  To: rjw, viresh.kumar, thierry.reding, jonathanh
  Cc: linux-pm, linux-tegra, linux-kernel, Yangtao Li

of_cpu_device_node_get() will increase the refcount of device_node,
it is necessary to call of_node_put() at the end to release the
refcount.

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
---
 drivers/cpufreq/tegra124-cpufreq.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/cpufreq/tegra124-cpufreq.c b/drivers/cpufreq/tegra124-cpufreq.c
index 43530254201a..140a9266b64a 100644
--- a/drivers/cpufreq/tegra124-cpufreq.c
+++ b/drivers/cpufreq/tegra124-cpufreq.c
@@ -118,6 +118,8 @@ static int tegra124_cpufreq_probe(struct platform_device *pdev)
 		goto out_put_pllx_clk;
 	}
 
+	of_node_put(np);
+
 	ret = tegra124_cpu_switch_to_dfll(priv);
 	if (ret)
 		goto out_put_pllp_clk;
-- 
2.17.0

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

* Re: [PATCH] cpufreq: tegra124: add missing of_node_put()
  2019-02-04  6:35 [PATCH] cpufreq: tegra124: add missing of_node_put() Yangtao Li
@ 2019-02-04  6:36 ` Viresh Kumar
  2019-02-04  7:00   ` Frank Lee
  2019-02-04  7:28 ` Thierry Reding
  1 sibling, 1 reply; 6+ messages in thread
From: Viresh Kumar @ 2019-02-04  6:36 UTC (permalink / raw)
  To: Yangtao Li
  Cc: rjw, thierry.reding, jonathanh, linux-pm, linux-tegra, linux-kernel

On 04-02-19, 01:35, Yangtao Li wrote:
> of_cpu_device_node_get() will increase the refcount of device_node,
> it is necessary to call of_node_put() at the end to release the
> refcount.
> 
> Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
> ---
>  drivers/cpufreq/tegra124-cpufreq.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/cpufreq/tegra124-cpufreq.c b/drivers/cpufreq/tegra124-cpufreq.c
> index 43530254201a..140a9266b64a 100644
> --- a/drivers/cpufreq/tegra124-cpufreq.c
> +++ b/drivers/cpufreq/tegra124-cpufreq.c
> @@ -118,6 +118,8 @@ static int tegra124_cpufreq_probe(struct platform_device *pdev)
>  		goto out_put_pllx_clk;
>  	}
>  
> +	of_node_put(np);
> +
>  	ret = tegra124_cpu_switch_to_dfll(priv);
>  	if (ret)
>  		goto out_put_pllp_clk;

Fixes and stable tags ?

-- 
viresh

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

* Re: [PATCH] cpufreq: tegra124: add missing of_node_put()
  2019-02-04  6:36 ` Viresh Kumar
@ 2019-02-04  7:00   ` Frank Lee
  2019-02-04  7:18     ` Viresh Kumar
  0 siblings, 1 reply; 6+ messages in thread
From: Frank Lee @ 2019-02-04  7:00 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: rjw, Thierry Reding, jonathanh, Linux PM, linux-tegra,
	Linux Kernel Mailing List

On Mon, Feb 4, 2019 at 2:36 PM Viresh Kumar <viresh.kumar@linaro.org> wrote:
>
> On 04-02-19, 01:35, Yangtao Li wrote:
> > of_cpu_device_node_get() will increase the refcount of device_node,
> > it is necessary to call of_node_put() at the end to release the
> > refcount.
> >
> > Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
> > ---
> >  drivers/cpufreq/tegra124-cpufreq.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/cpufreq/tegra124-cpufreq.c b/drivers/cpufreq/tegra124-cpufreq.c
> > index 43530254201a..140a9266b64a 100644
> > --- a/drivers/cpufreq/tegra124-cpufreq.c
> > +++ b/drivers/cpufreq/tegra124-cpufreq.c
> > @@ -118,6 +118,8 @@ static int tegra124_cpufreq_probe(struct platform_device *pdev)
> >               goto out_put_pllx_clk;
> >       }
> >
> > +     of_node_put(np);
> > +
> >       ret = tegra124_cpu_switch_to_dfll(priv);
> >       if (ret)
> >               goto out_put_pllp_clk;
>
> Fixes and stable tags ?
Hi viresh,

Like this?

Fixes: 9eb15dbbfa1a2 ("cpufreq: Add cpufreq driver for Tegra124")
Cc: stable@vger.kernel.org

MBR,
Yangtao
>
> --
> viresh

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

* Re: [PATCH] cpufreq: tegra124: add missing of_node_put()
  2019-02-04  7:00   ` Frank Lee
@ 2019-02-04  7:18     ` Viresh Kumar
  2019-02-04  7:26       ` Frank Lee
  0 siblings, 1 reply; 6+ messages in thread
From: Viresh Kumar @ 2019-02-04  7:18 UTC (permalink / raw)
  To: Frank Lee
  Cc: rjw, Thierry Reding, jonathanh, Linux PM, linux-tegra,
	Linux Kernel Mailing List

On 04-02-19, 15:00, Frank Lee wrote:
> On Mon, Feb 4, 2019 at 2:36 PM Viresh Kumar <viresh.kumar@linaro.org> wrote:
> >
> > On 04-02-19, 01:35, Yangtao Li wrote:
> > > of_cpu_device_node_get() will increase the refcount of device_node,
> > > it is necessary to call of_node_put() at the end to release the
> > > refcount.
> > >
> > > Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
> > > ---
> > >  drivers/cpufreq/tegra124-cpufreq.c | 2 ++
> > >  1 file changed, 2 insertions(+)
> > >
> > > diff --git a/drivers/cpufreq/tegra124-cpufreq.c b/drivers/cpufreq/tegra124-cpufreq.c
> > > index 43530254201a..140a9266b64a 100644
> > > --- a/drivers/cpufreq/tegra124-cpufreq.c
> > > +++ b/drivers/cpufreq/tegra124-cpufreq.c
> > > @@ -118,6 +118,8 @@ static int tegra124_cpufreq_probe(struct platform_device *pdev)
> > >               goto out_put_pllx_clk;
> > >       }
> > >
> > > +     of_node_put(np);
> > > +
> > >       ret = tegra124_cpu_switch_to_dfll(priv);
> > >       if (ret)
> > >               goto out_put_pllp_clk;
> >
> > Fixes and stable tags ?
> Hi viresh,
> 
> Like this?
> 
> Fixes: 9eb15dbbfa1a2 ("cpufreq: Add cpufreq driver for Tegra124")
> Cc: stable@vger.kernel.org

This needs to be something like:

Cc: 4.5+ stable@vger.kernel.org #4.5+

Also I don't think your patch is entirely correct as we will end up
doing of_node_put() twice in error path.

-- 
viresh

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

* Re: [PATCH] cpufreq: tegra124: add missing of_node_put()
  2019-02-04  7:18     ` Viresh Kumar
@ 2019-02-04  7:26       ` Frank Lee
  0 siblings, 0 replies; 6+ messages in thread
From: Frank Lee @ 2019-02-04  7:26 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: rjw, Thierry Reding, jonathanh, Linux PM, linux-tegra,
	Linux Kernel Mailing List

On Mon, Feb 4, 2019 at 3:18 PM Viresh Kumar <viresh.kumar@linaro.org> wrote:
>
> On 04-02-19, 15:00, Frank Lee wrote:
> > On Mon, Feb 4, 2019 at 2:36 PM Viresh Kumar <viresh.kumar@linaro.org> wrote:
> > >
> > > On 04-02-19, 01:35, Yangtao Li wrote:
> > > > of_cpu_device_node_get() will increase the refcount of device_node,
> > > > it is necessary to call of_node_put() at the end to release the
> > > > refcount.
> > > >
> > > > Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
> > > > ---
> > > >  drivers/cpufreq/tegra124-cpufreq.c | 2 ++
> > > >  1 file changed, 2 insertions(+)
> > > >
> > > > diff --git a/drivers/cpufreq/tegra124-cpufreq.c b/drivers/cpufreq/tegra124-cpufreq.c
> > > > index 43530254201a..140a9266b64a 100644
> > > > --- a/drivers/cpufreq/tegra124-cpufreq.c
> > > > +++ b/drivers/cpufreq/tegra124-cpufreq.c
> > > > @@ -118,6 +118,8 @@ static int tegra124_cpufreq_probe(struct platform_device *pdev)
> > > >               goto out_put_pllx_clk;
> > > >       }
> > > >
> > > > +     of_node_put(np);
> > > > +
> > > >       ret = tegra124_cpu_switch_to_dfll(priv);
> > > >       if (ret)
> > > >               goto out_put_pllp_clk;
> > >
> > > Fixes and stable tags ?
> > Hi viresh,
> >
> > Like this?
> >
> > Fixes: 9eb15dbbfa1a2 ("cpufreq: Add cpufreq driver for Tegra124")
> > Cc: stable@vger.kernel.org
>
> This needs to be something like:
>
> Cc: 4.5+ stable@vger.kernel.org #4.5+
>
> Also I don't think your patch is entirely correct as we will end up
> doing of_node_put() twice in error path.
Thanks for your reminder, I will modify it immediately.

MBR,
Yangtao
>
> --
> viresh

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

* Re: [PATCH] cpufreq: tegra124: add missing of_node_put()
  2019-02-04  6:35 [PATCH] cpufreq: tegra124: add missing of_node_put() Yangtao Li
  2019-02-04  6:36 ` Viresh Kumar
@ 2019-02-04  7:28 ` Thierry Reding
  1 sibling, 0 replies; 6+ messages in thread
From: Thierry Reding @ 2019-02-04  7:28 UTC (permalink / raw)
  To: Yangtao Li
  Cc: rjw, viresh.kumar, jonathanh, linux-pm, linux-tegra, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 999 bytes --]

On Mon, Feb 04, 2019 at 01:35:01AM -0500, Yangtao Li wrote:
> of_cpu_device_node_get() will increase the refcount of device_node,
> it is necessary to call of_node_put() at the end to release the
> refcount.
> 
> Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
> ---
>  drivers/cpufreq/tegra124-cpufreq.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/cpufreq/tegra124-cpufreq.c b/drivers/cpufreq/tegra124-cpufreq.c
> index 43530254201a..140a9266b64a 100644
> --- a/drivers/cpufreq/tegra124-cpufreq.c
> +++ b/drivers/cpufreq/tegra124-cpufreq.c
> @@ -118,6 +118,8 @@ static int tegra124_cpufreq_probe(struct platform_device *pdev)
>  		goto out_put_pllx_clk;
>  	}
>  
> +	of_node_put(np);
> +
>  	ret = tegra124_cpu_switch_to_dfll(priv);
>  	if (ret)
>  		goto out_put_pllp_clk;

I think this needs to move to the very end of the function, for example
after the call to platform_set_drvdata(), to avoid releasing it twice in
error paths.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2019-02-04  7:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-04  6:35 [PATCH] cpufreq: tegra124: add missing of_node_put() Yangtao Li
2019-02-04  6:36 ` Viresh Kumar
2019-02-04  7:00   ` Frank Lee
2019-02-04  7:18     ` Viresh Kumar
2019-02-04  7:26       ` Frank Lee
2019-02-04  7:28 ` Thierry Reding

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.