[PATCH 0/5] add missing of_node_put

From: Julia Lawall
Date: Sat Oct 10 2015 - 08:41:58 EST


for_each_child_of_node performs an of_node_get on each iteration, so
a break out of the loop requires an of_node_put.

The complete semantic patch that fixes this problem is
(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
+ of_node_put(child);
? break;
...
}
... when != child

@@
expression root,e;
local idexpression child;
@@

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

---

arch/arm/kernel/devtree.c | 1 +
arch/arm/mach-shmobile/pm-rmobile.c | 4 +++-
drivers/power/charger-manager.c | 4 +++-
drivers/regulator/of_regulator.c | 1 +
drivers/video/backlight/88pm860x_bl.c | 1 +
5 files changed, 9 insertions(+), 2 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/