提交 b855f16b 编写于 作者: T Tang Yuantian 提交者: Grant Likely

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: NTang Yuantian <Yuantian.Tang@freescale.com>
[grant.likely: tightened up the patch]
Signed-off-by: NGrant Likely <grant.likely@linaro.org>
上级 48d045db
...@@ -1166,11 +1166,11 @@ static int __of_parse_phandle_with_args(const struct device_node *np, ...@@ -1166,11 +1166,11 @@ static int __of_parse_phandle_with_args(const struct device_node *np,
out_args->args_count = count; out_args->args_count = count;
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
out_args->args[i] = be32_to_cpup(list++); out_args->args[i] = be32_to_cpup(list++);
} else {
of_node_put(node);
} }
/* Found it! return success */ /* Found it! return success */
if (node)
of_node_put(node);
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册