of: fix reference counting in of_graph_get_endpoint_by_regs
authorLucas Stach <l.stach@pengutronix.de>
Mon, 15 Aug 2016 12:58:43 +0000 (14:58 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 7 Sep 2016 06:34:49 +0000 (08:34 +0200)
commitada4606e166e930ade9ed1e3815ed5817f128fc3
tree9ac7e23646bdde42cc66c5cbb16a7ba607003274
parentd066c41d10f0b2c6f8c6fb477e7d3152fdf5a8d8
of: fix reference counting in of_graph_get_endpoint_by_regs

commit 34276bb062b8449b3b0a208c9b848a1a27920075 upstream.

The called of_graph_get_next_endpoint() already decrements the refcount
of the prev node, so it is wrong to do it again in the calling function.

Use the for_each_endpoint_of_node() helper to interate through the
endpoint OF nodes, which already does the right thing and simplifies
the code a bit.

Fixes: 8ccd0d0ca041
(of: add helper for getting endpoint node of specific identifiers)
Reported-by: David Jander <david@protonic.nl>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/of/base.c