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

Stephen Rothwell sfr at canb.auug.org.au
Wed Apr 10 19:03:27 EST 2013


Hi,

On Tue, 9 Apr 2013 14:56:09 +0800 <Yuantian.Tang at freescale.com> wrote:
>
> From: Tang Yuantian <yuantian.tang at 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 at 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 at canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20130410/5be200ea/attachment.sig>


More information about the Linuxppc-dev mailing list