From: Julia Lawall <hidden> Date: 2015-10-25 14:08:24
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.
A simplified version of the semantic patch that fixes this problem is as
follows (http://coccinelle.lip6.fr):
// <smpl>
@@
local idexpression r.n;
expression r,e;
@@
for_each_child_of_node(r,n) {
...
(
of_node_put(n);
|
e = n
|
+ of_node_put(n);
? break;
)
...
}
... when != n
// </smpl>
Signed-off-by: Julia Lawall <redacted>
---
drivers/net/ethernet/cavium/thunder/thunder_bgx.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
From: Julia Lawall <hidden> Date: 2015-10-25 14:09:16
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>
@@
local idexpression r.n;
expression r,e;
@@
for_each_available_child_of_node(r,n) {
...
(
of_node_put(n);
|
e = n
|
+ of_node_put(n);
? break;
)
...
}
... when != n
// </smpl>
Signed-off-by: Julia Lawall <redacted>
---
drivers/net/phy/mdio-mux.c | 1 +
1 file changed, 1 insertion(+)
@@ -144,6 +144,7 @@ int mdio_mux_init(struct device *dev,dev_err(dev,"Error: Failed to allocate memory for child\n");ret_val=-ENOMEM;+of_node_put(child_bus_node);break;}cb->bus_number=v;
From: Julia Lawall <hidden> Date: 2015-10-25 14:09:19
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 <redacted>
---
drivers/net/phy/mdio-mux-mmioreg.c | 2 ++
1 file changed, 2 insertions(+)
@@ -113,12 +113,14 @@ static int mdio_mux_mmioreg_probe(struct platform_device *pdev)if(!iprop||len!=sizeof(uint32_t)){dev_err(&pdev->dev,"mdio-mux child node %s is ""missing a 'reg' property\n",np2->full_name);+of_node_put(np2);return-ENODEV;}if(be32_to_cpup(iprop)&~s->mask){dev_err(&pdev->dev,"mdio-mux child node %s has ""a 'reg' value with unmasked bits\n",np2->full_name);+of_node_put(np2);return-ENODEV;}}
From: Julia Lawall <hidden> Date: 2015-10-25 14:09:25
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 <redacted>
---
drivers/net/ethernet/marvell/mv643xx_eth.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
From: Julia Lawall <hidden> Date: 2015-10-25 14:09:27
for_each_compatible_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 e;
local idexpression n;
@@
for_each_compatible_node(n,...) {
... when != of_node_put(n)
when != e = n
(
return n;
|
+ of_node_put(n);
? return ...;
)
...
}
// </smpl>
Signed-off-by: Julia Lawall <redacted>
---
drivers/net/wireless/ath/ath6kl/init.c | 1 +
1 file changed, 1 insertion(+)
From: Julia Lawall <hidden> Date: 2015-10-25 14:09:30
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.
A simplified version of the semantic patch that fixes this problem is as
follows (http://coccinelle.lip6.fr):
// <smpl>
@@
local idexpression r.n;
expression r,e;
@@
for_each_child_of_node(r,n) {
...
(
of_node_put(n);
|
e = n
|
+ of_node_put(n);
? break;
)
...
}
... when != n
// </smpl>
Signed-off-by: Julia Lawall <redacted>
---
drivers/net/ethernet/ti/netcp_ethss.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
From: David Miller <davem@davemloft.net> Date: 2015-10-27 04:52:13
From: Julia Lawall <redacted>
Date: Sun, 25 Oct 2015 14:56:59 +0100
The various for_each device_node iterators 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):