diff options
author | Tang Yuantian <yuantian.tang@freescale.com> | 2013-04-09 23:36:39 -0400 |
---|---|---|
committer | Grant Likely <grant.likely@linaro.org> | 2013-04-17 10:53:12 -0400 |
commit | b855f16b05a697ac1863adabe99bfba56e6d3199 (patch) | |
tree | 881f7a861790c977ad6d645bf2928b72a15d4d20 | |
parent | 48d045dbe9c757681edfe8274211254c56d53a41 (diff) |
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 <Yuantian.Tang@freescale.com>
[grant.likely: tightened up the patch]
Signed-off-by: Grant Likely <grant.likely@linaro.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, | |||
1166 | out_args->args_count = count; | 1166 | out_args->args_count = count; |
1167 | for (i = 0; i < count; i++) | 1167 | for (i = 0; i < count; i++) |
1168 | out_args->args[i] = be32_to_cpup(list++); | 1168 | out_args->args[i] = be32_to_cpup(list++); |
1169 | } else { | ||
1170 | of_node_put(node); | ||
1169 | } | 1171 | } |
1170 | 1172 | ||
1171 | /* Found it! return success */ | 1173 | /* Found it! return success */ |
1172 | if (node) | ||
1173 | of_node_put(node); | ||
1174 | return 0; | 1174 | return 0; |
1175 | } | 1175 | } |
1176 | 1176 | ||