diff options
author | Tang Yuantian <yuantian.tang@freescale.com> | 2013-04-10 11:36:39 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-07-03 10:55:36 -0700 |
commit | 3dec0d57dee4be55b50cc8fa8cfbf78c77a50712 (patch) | |
tree | 6b9ca92176141f2df2ccd7d704a923116ca68402 | |
parent | 22cd748cf97f4ea97a776bc246b7932f6c9f050e (diff) |
of/base: release the node correctly in of_parse_phandle_with_args()
commit b855f16b05a697ac1863adabe99bfba56e6d3199 upstream.
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@freescale.com>
[grant.likely: tightened up the patch]
Signed-off-by: Grant Likely <grant.likely@linaro.org>
Cc: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/of/base.c | 4 |
1 files changed, 2 insertions, 2 deletions
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; } |