Skip to content

Commit 2181636

Browse files
JuliaLawalllinusw
authored andcommitted
pinctrl: at91-pio4: add missing of_node_put
The device node iterators perform an of_node_get on each iteration, so a jump out of the loop requires an of_node_put. The semantic patch that fixes 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 + of_node_put(child); ? break; ... } ... when != child // </smpl> Signed-off-by: Julia Lawall <[email protected]> Acked-by: Ludovic Desroches <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
1 parent 702d1e8 commit 2181636

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/pinctrl/pinctrl-at91-pio4.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,8 +576,10 @@ static int atmel_pctl_dt_node_to_map(struct pinctrl_dev *pctldev,
576576
for_each_child_of_node(np_config, np) {
577577
ret = atmel_pctl_dt_subnode_to_map(pctldev, np, map,
578578
&reserved_maps, num_maps);
579-
if (ret < 0)
579+
if (ret < 0) {
580+
of_node_put(np);
580581
break;
582+
}
581583
}
582584
}
583585

0 commit comments

Comments
 (0)