From: Tang Yuantian <yuantian.t...@freescale.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.

Upstream commit: b855f16b05a697ac1863adabe99bfba56e6d3199

Signed-off-by: Tang Yuantian <yuantian.t...@freescale.com>
[grant.likely: tightened up the patch]
Signed-off-by: Grant Likely <grant.lik...@linaro.org>
---
Only relevant for 3.9.

 drivers/of/base.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index 321d3ef..e77e719 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;
                }
 
-- 
1.7.9.7

--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to