* [PATCH] of: remove the unnecessary of_node_put for of_parse_phandle_with_args()
@ 2013-04-09 6:56 Yuantian.Tang
2013-04-10 9:03 ` Stephen Rothwell
0 siblings, 1 reply; 4+ messages in thread
From: Yuantian.Tang @ 2013-04-09 6:56 UTC (permalink / raw)
To: grant.likely
Cc: rob.herring, devicetree-discuss, linux-kernel, linuxppc-dev,
Tang Yuantian, Tang Yuantian
From: Tang Yuantian <yuantian.tang@freescale.com>
As the function itself says it is caller's responsibility to call the
of_node_put(). So, remove it on success to keep the reference count
correct.
Signed-off-by: Tang Yuantian <Yuantian.Tang@freescale.com>
---
drivers/of/base.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 321d3ef..e8b4c28 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -1168,9 +1168,6 @@ static int __of_parse_phandle_with_args(const struct device_node *np,
out_args->args[i] = be32_to_cpup(list++);
}
- /* Found it! return success */
- if (node)
- of_node_put(node);
return 0;
}
--
1.8.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] of: remove the unnecessary of_node_put for of_parse_phandle_with_args()
2013-04-09 6:56 [PATCH] of: remove the unnecessary of_node_put for of_parse_phandle_with_args() Yuantian.Tang
@ 2013-04-10 9:03 ` Stephen Rothwell
2013-04-10 9:06 ` Tang Yuantian-B29983
0 siblings, 1 reply; 4+ messages in thread
From: Stephen Rothwell @ 2013-04-10 9:03 UTC (permalink / raw)
To: Yuantian.Tang
Cc: grant.likely, devicetree-discuss, linuxppc-dev, linux-kernel,
rob.herring
[-- Attachment #1: Type: text/plain, Size: 1097 bytes --]
Hi,
On Tue, 9 Apr 2013 14:56:09 +0800 <Yuantian.Tang@freescale.com> wrote:
>
> From: Tang Yuantian <yuantian.tang@freescale.com>
>
> As the function itself says it is caller's responsibility to call the
> of_node_put(). So, remove it on success to keep the reference count
> correct.
>
> Signed-off-by: Tang Yuantian <Yuantian.Tang@freescale.com>
> ---
> drivers/of/base.c | 3 ---
> 1 file changed, 3 deletions(-)
>
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index 321d3ef..e8b4c28 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -1168,9 +1168,6 @@ static int __of_parse_phandle_with_args(const struct device_node *np,
> out_args->args[i] = be32_to_cpup(list++);
> }
>
> - /* Found it! return success */
> - if (node)
> - of_node_put(node);
Actually, if out_args is NULL, you should do the of_node_put(node), so
probably the correct fix is to add an "else" before the above "if" (and
move the comment).
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] of: remove the unnecessary of_node_put for of_parse_phandle_with_args()
2013-04-10 9:03 ` Stephen Rothwell
@ 2013-04-10 9:06 ` Tang Yuantian-B29983
2013-04-10 11:09 ` Stephen Rothwell
0 siblings, 1 reply; 4+ messages in thread
From: Tang Yuantian-B29983 @ 2013-04-10 9:06 UTC (permalink / raw)
To: Stephen Rothwell
Cc: grant.likely@secretlab.ca, devicetree-discuss@lists.ozlabs.org,
linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
rob.herring@calxeda.com
> -----Original Message-----
> From: Stephen Rothwell [mailto:sfr@canb.auug.org.au]
> Sent: 2013年4月10日 17:03
> To: Tang Yuantian-B29983
> Cc: grant.likely@secretlab.ca; devicetree-discuss@lists.ozlabs.org;
> linuxppc-dev@lists.ozlabs.org; linux-kernel@vger.kernel.org;
> rob.herring@calxeda.com
> Subject: Re: [PATCH] of: remove the unnecessary of_node_put for
> of_parse_phandle_with_args()
>
> Hi,
>
> On Tue, 9 Apr 2013 14:56:09 +0800 <Yuantian.Tang@freescale.com> wrote:
> >
> > From: Tang Yuantian <yuantian.tang@freescale.com>
> >
> > As the function itself says it is caller's responsibility to call the
> > of_node_put(). So, remove it on success to keep the reference count
> > correct.
> >
> > Signed-off-by: Tang Yuantian <Yuantian.Tang@freescale.com>
> > ---
> > drivers/of/base.c | 3 ---
> > 1 file changed, 3 deletions(-)
> >
> > diff --git a/drivers/of/base.c b/drivers/of/base.c index
> > 321d3ef..e8b4c28 100644
> > --- a/drivers/of/base.c
> > +++ b/drivers/of/base.c
> > @@ -1168,9 +1168,6 @@ static int __of_parse_phandle_with_args(const
> struct device_node *np,
> > out_args->args[i] = be32_to_cpup(list++);
> > }
> >
> > - /* Found it! return success */
> > - if (node)
> > - of_node_put(node);
>
> Actually, if out_args is NULL, you should do the of_node_put(node), so
> probably the correct fix is to add an "else" before the above "if" (and
> move the comment).
>
Yes, I already sent out the v2 patch.
Please see: http://patchwork.ozlabs.org/patch/235288/
Regards,
Yuantian
> --
> Cheers,
> Stephen Rothwell sfr@canb.auug.org.au
> http://www.canb.auug.org.au/~sfr/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] of: remove the unnecessary of_node_put for of_parse_phandle_with_args()
2013-04-10 9:06 ` Tang Yuantian-B29983
@ 2013-04-10 11:09 ` Stephen Rothwell
0 siblings, 0 replies; 4+ messages in thread
From: Stephen Rothwell @ 2013-04-10 11:09 UTC (permalink / raw)
To: Tang Yuantian-B29983
Cc: grant.likely@secretlab.ca, devicetree-discuss@lists.ozlabs.org,
linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
rob.herring@calxeda.com
[-- Attachment #1: Type: text/plain, Size: 334 bytes --]
Hi,
On Wed, 10 Apr 2013 09:06:11 +0000 Tang Yuantian-B29983 <B29983@freescale.com> wrote:
>
> Yes, I already sent out the v2 patch.
> Please see: http://patchwork.ozlabs.org/patch/235288/
Thanks. I should read all my email before replying to it :-)
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-04-10 11:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-09 6:56 [PATCH] of: remove the unnecessary of_node_put for of_parse_phandle_with_args() Yuantian.Tang
2013-04-10 9:03 ` Stephen Rothwell
2013-04-10 9:06 ` Tang Yuantian-B29983
2013-04-10 11:09 ` Stephen Rothwell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).