]> www.infradead.org Git - users/jedix/linux-maple.git/commit
drm/imx: imx-ldb: add missing of_node_puts
authorJulia Lawall <Julia.Lawall@lip6.fr>
Sun, 13 Jan 2019 08:47:42 +0000 (09:47 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 23 Mar 2019 13:35:10 +0000 (14:35 +0100)
commit1839b1f67120f8f6427a237dd9616ddf30d96274
treebd86f8c31aa99540cda2150422dc3d02e6901733
parenta0e11262c67ef2eb75f93651643fb8345ab282c4
drm/imx: imx-ldb: add missing of_node_puts

[ Upstream commit aa3312012f103f91f123600bbf768b11c8f431bc ]

The device node iterators perform an of_node_get on each
iteration, so a jump out of the loop requires an of_node_put.

Move the initialization channel->child = child; down to just
before the call to imx_ldb_register so that intervening failures
don't need to clear it.  Add a label at the end of the function to
do all the of_node_puts.

The semantic patch that finds part of this problem is as follows
(http://coccinelle.lip6.fr):

// <smpl>
@@
expression root,e;
local idexpression child;
iterator name for_each_child_of_node;
@@

 for_each_child_of_node(root, child) {
   ... when != of_node_put(child)
       when != e = child
(
   return child;
|
*  return ...;
)
   ...
 }
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/imx/imx-ldb.c