[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <D07C73A334FF604B95B3CBD2A545D07B0B144FD3@039-SN2MPN1-013.039d.mgd.msft.net>
Date: Tue, 16 Apr 2013 06:54:40 +0000
From: Tang Yuantian-B29983 <B29983@...escale.com>
To: Tang Yuantian-B29983 <B29983@...escale.com>,
"grant.likely@...retlab.ca" <grant.likely@...retlab.ca>
CC: "rob.herring@...xeda.com" <rob.herring@...xeda.com>,
"devicetree-discuss@...ts.ozlabs.org"
<devicetree-discuss@...ts.ozlabs.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linuxppc-dev@...ts.ozlabs.org" <linuxppc-dev@...ts.ozlabs.org>
Subject: RE: [PATCH v2] of/base: release the node correctly in
of_parse_phandle_with_args()
Hi Grant.likely,
I really preciate if you can spend some times to review this patch.
Thanks,
Yuantian
> -----Original Message-----
> From: Tang Yuantian-B29983
> Sent: 2013年4月10日 11:37
> To: grant.likely@...retlab.ca
> Cc: rob.herring@...xeda.com; devicetree-discuss@...ts.ozlabs.org; linux-
> kernel@...r.kernel.org; linuxppc-dev@...ts.ozlabs.org; Tang Yuantian-
> B29983; Tang Yuantian-B29983
> Subject: [PATCH v2] of/base: release the node correctly in
> of_parse_phandle_with_args()
>
> From: Tang Yuantian <yuantian.tang@...escale.com>
>
> Call of_node_put() only when the out_args is NULL on success, or the
> node's reference count will not be correct because the caller will call
> of_node_put() again.
>
> Signed-off-by: Tang Yuantian <Yuantian.Tang@...escale.com>
> ---
> v2:
> - modified the title and description. the 1st patch title is:
> of: remove the unnecessary of_node_put for
> of_parse_phandle_with_args()
> the 1st patch is not good enough.
>
> drivers/of/base.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/of/base.c b/drivers/of/base.c index 321d3ef..ee94f64
> 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -1158,6 +1158,7 @@ static int __of_parse_phandle_with_args(const
> struct device_node *np,
> if (!phandle)
> goto err;
>
> + /* Found it! return success */
> if (out_args) {
> int i;
> if (WARN_ON(count > MAX_PHANDLE_ARGS)) @@ -
> 1166,11 +1167,10 @@ static int __of_parse_phandle_with_args(const struct
> device_node *np,
> out_args->args_count = count;
> for (i = 0; i < count; i++)
> out_args->args[i] = be32_to_cpup(list++);
> + } else if (node) {
> + of_node_put(node);
> }
>
> - /* Found it! return success */
> - if (node)
> - of_node_put(node);
> return 0;
> }
>
> --
> 1.8.0
Powered by blists - more mailing lists