From: Tang Yuantian Date: Wed, 10 Apr 2013 03:36:39 +0000 (+0800) Subject: of/base: release the node correctly in of_parse_phandle_with_args() X-Git-Tag: firefly_0821_release~3680^2~453^2~1 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=b855f16b05a697ac1863adabe99bfba56e6d3199;p=firefly-linux-kernel-4.4.55.git of/base: release the node correctly in of_parse_phandle_with_args() 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 [grant.likely: tightened up the patch] Signed-off-by: Grant Likely --- diff --git a/drivers/of/base.c b/drivers/of/base.c index 321d3ef05006..e77e71989e81 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -1166,11 +1166,11 @@ 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 { + of_node_put(node); } /* Found it! return success */ - if (node) - of_node_put(node); return 0; }