2013-04-09 07:34:53

by Tang Yuantian

[permalink] [raw]
Subject: [PATCH] of: remove the unnecessary of_node_put for of_parse_phandle_with_args()

From: Tang Yuantian <[email protected]>

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 <[email protected]>
---
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


2013-04-10 09:03:39

by Stephen Rothwell

[permalink] [raw]
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 <[email protected]> wrote:
>
> From: Tang Yuantian <[email protected]>
>
> 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 <[email protected]>
> ---
> 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 [email protected]
http://www.canb.auug.org.au/~sfr/


Attachments:
(No filename) (1.04 kB)
(No filename) (836.00 B)
Download all attachments

2013-04-10 09:06:17

by Tang Yuantian-B29983

[permalink] [raw]
Subject: RE: [PATCH] of: remove the unnecessary of_node_put for of_parse_phandle_with_args()


> -----Original Message-----
> From: Stephen Rothwell [mailto:[email protected]]
> Sent: 2013??4??10?? 17:03
> To: Tang Yuantian-B29983
> Cc: [email protected]; [email protected];
> [email protected]; [email protected];
> [email protected]
> 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 <[email protected]> wrote:
> >
> > From: Tang Yuantian <[email protected]>
> >
> > 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 <[email protected]>
> > ---
> > 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 [email protected]
> http://www.canb.auug.org.au/~sfr/
????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?

2013-04-10 11:10:08

by Stephen Rothwell

[permalink] [raw]
Subject: Re: [PATCH] of: remove the unnecessary of_node_put for of_parse_phandle_with_args()

Hi,

On Wed, 10 Apr 2013 09:06:11 +0000 Tang Yuantian-B29983 <[email protected]> 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 [email protected]


Attachments:
(No filename) (322.00 B)
(No filename) (836.00 B)
Download all attachments