Skip to content

Commit 26b7974

Browse files
JuliaLawalldavem330
authored andcommitted
net: mv643xx_eth: add missing of_node_put
for_each_available_child_of_node performs an of_node_get on each iteration, so a break out of the loop requires an of_node_put. A simplified version of the semantic patch that fixes this problem is as follows (http://coccinelle.lip6.fr): // <smpl> @@ expression root,e; local idexpression child; @@ for_each_available_child_of_node(root, child) { ... when != of_node_put(child) when != e = child ( return child; | + of_node_put(child); ? return ...; ) ... } // </smpl> Signed-off-by: Julia Lawall <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 81a5770 commit 26b7974

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/net/ethernet/marvell/mv643xx_eth.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2817,8 +2817,10 @@ static int mv643xx_eth_shared_of_probe(struct platform_device *pdev)
28172817

28182818
for_each_available_child_of_node(np, pnp) {
28192819
ret = mv643xx_eth_shared_of_add_port(pdev, pnp);
2820-
if (ret)
2820+
if (ret) {
2821+
of_node_put(pnp);
28212822
return ret;
2823+
}
28222824
}
28232825
return 0;
28242826
}

0 commit comments

Comments
 (0)