linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] add missing of_node_put
@ 2015-10-10 12:30 Julia Lawall
  2015-10-10 12:30 ` [PATCH 3/5] ARM: shmobile: R-Mobile: " Julia Lawall
  0 siblings, 1 reply; 8+ messages in thread
From: Julia Lawall @ 2015-10-10 12:30 UTC (permalink / raw)
  To: linux-arm-kernel

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(-)

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-10-12  7:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-10 12:30 [PATCH 0/5] add missing of_node_put Julia Lawall
2015-10-10 12:30 ` [PATCH 3/5] ARM: shmobile: R-Mobile: " Julia Lawall
2015-10-12  0:16   ` Simon Horman
2015-10-12  7:18   ` Geert Uytterhoeven
2015-10-12  7:24     ` Julia Lawall
2015-10-12  7:26       ` Geert Uytterhoeven
2015-10-12  7:29     ` Thomas Petazzoni
2015-10-12  7:30       ` Geert Uytterhoeven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).