Skip to content

Commit

Permalink
of/base: release the node correctly in of_parse_phandle_with_args()
Browse files Browse the repository at this point in the history
commit b855f16 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>
  • Loading branch information
Tang Yuantian authored and Greg Kroah-Hartman committed Jul 3, 2013
1 parent 22cd748 commit 3dec0d5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/of/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 3dec0d5

Please sign in to comment.