* [PATCH 1/5] pinctrl: at91-pio4: add missing of_node_put
2018-05-23 19:07 [PATCH 0/5] add missing of_node_put Julia Lawall
@ 2018-05-23 19:07 ` Julia Lawall
2018-05-24 7:59 ` Ludovic Desroches
2018-05-24 8:30 ` Linus Walleij
2018-05-23 19:07 ` [PATCH 3/5] soc: ti: knav_dma: " Julia Lawall
2018-05-23 19:07 ` [PATCH 5/5] drm/rockchip: lvds: " Julia Lawall
2 siblings, 2 replies; 7+ messages in thread
From: Julia Lawall @ 2018-05-23 19:07 UTC (permalink / raw)
To: linux-arm-kernel
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 <Julia.Lawall@lip6.fr>
---
drivers/pinctrl/pinctrl-at91-pio4.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/pinctrl/pinctrl-at91-pio4.c b/drivers/pinctrl/pinctrl-at91-pio4.c
index 4b57a13..bafb3d4 100644
--- a/drivers/pinctrl/pinctrl-at91-pio4.c
+++ b/drivers/pinctrl/pinctrl-at91-pio4.c
@@ -576,8 +576,10 @@ static int atmel_pctl_dt_node_to_map(struct pinctrl_dev *pctldev,
for_each_child_of_node(np_config, np) {
ret = atmel_pctl_dt_subnode_to_map(pctldev, np, map,
&reserved_maps, num_maps);
- if (ret < 0)
+ if (ret < 0) {
+ of_node_put(np);
break;
+ }
}
}
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 1/5] pinctrl: at91-pio4: add missing of_node_put
2018-05-23 19:07 ` [PATCH 1/5] pinctrl: at91-pio4: " Julia Lawall
@ 2018-05-24 7:59 ` Ludovic Desroches
2018-05-24 8:30 ` Linus Walleij
1 sibling, 0 replies; 7+ messages in thread
From: Ludovic Desroches @ 2018-05-24 7:59 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, May 23, 2018 at 09:07:12PM +0200, Julia Lawall wrote:
> 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 <Julia.Lawall@lip6.fr>
Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com>
Thanks
>
> ---
> drivers/pinctrl/pinctrl-at91-pio4.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pinctrl/pinctrl-at91-pio4.c b/drivers/pinctrl/pinctrl-at91-pio4.c
> index 4b57a13..bafb3d4 100644
> --- a/drivers/pinctrl/pinctrl-at91-pio4.c
> +++ b/drivers/pinctrl/pinctrl-at91-pio4.c
> @@ -576,8 +576,10 @@ static int atmel_pctl_dt_node_to_map(struct pinctrl_dev *pctldev,
> for_each_child_of_node(np_config, np) {
> ret = atmel_pctl_dt_subnode_to_map(pctldev, np, map,
> &reserved_maps, num_maps);
> - if (ret < 0)
> + if (ret < 0) {
> + of_node_put(np);
> break;
> + }
> }
> }
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH 1/5] pinctrl: at91-pio4: add missing of_node_put
2018-05-23 19:07 ` [PATCH 1/5] pinctrl: at91-pio4: " Julia Lawall
2018-05-24 7:59 ` Ludovic Desroches
@ 2018-05-24 8:30 ` Linus Walleij
1 sibling, 0 replies; 7+ messages in thread
From: Linus Walleij @ 2018-05-24 8:30 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, May 23, 2018 at 9:07 PM, Julia Lawall <Julia.Lawall@lip6.fr> wrote:
> 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 <Julia.Lawall@lip6.fr>
Patch applied with Ludovic's ACK!
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 3/5] soc: ti: knav_dma: add missing of_node_put
2018-05-23 19:07 [PATCH 0/5] add missing of_node_put Julia Lawall
2018-05-23 19:07 ` [PATCH 1/5] pinctrl: at91-pio4: " Julia Lawall
@ 2018-05-23 19:07 ` Julia Lawall
2018-05-23 19:07 ` [PATCH 5/5] drm/rockchip: lvds: " Julia Lawall
2 siblings, 0 replies; 7+ messages in thread
From: Julia Lawall @ 2018-05-23 19:07 UTC (permalink / raw)
To: linux-arm-kernel
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 <Julia.Lawall@lip6.fr>
---
drivers/soc/ti/knav_dma.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/soc/ti/knav_dma.c b/drivers/soc/ti/knav_dma.c
index 224d7dd..bda3173 100644
--- a/drivers/soc/ti/knav_dma.c
+++ b/drivers/soc/ti/knav_dma.c
@@ -768,6 +768,7 @@ static int knav_dma_probe(struct platform_device *pdev)
ret = dma_init(node, child);
if (ret) {
dev_err(&pdev->dev, "init failed with %d\n", ret);
+ of_node_put(child);
break;
}
}
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 5/5] drm/rockchip: lvds: add missing of_node_put
2018-05-23 19:07 [PATCH 0/5] add missing of_node_put Julia Lawall
2018-05-23 19:07 ` [PATCH 1/5] pinctrl: at91-pio4: " Julia Lawall
2018-05-23 19:07 ` [PATCH 3/5] soc: ti: knav_dma: " Julia Lawall
@ 2018-05-23 19:07 ` Julia Lawall
2018-06-16 12:24 ` Heiko Stübner
2 siblings, 1 reply; 7+ messages in thread
From: Julia Lawall @ 2018-05-23 19:07 UTC (permalink / raw)
To: linux-arm-kernel
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 <Julia.Lawall@lip6.fr>
---
drivers/gpu/drm/rockchip/rockchip_lvds.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/rockchip/rockchip_lvds.c b/drivers/gpu/drm/rockchip/rockchip_lvds.c
index e67f4ea..051b8be 100644
--- a/drivers/gpu/drm/rockchip/rockchip_lvds.c
+++ b/drivers/gpu/drm/rockchip/rockchip_lvds.c
@@ -363,8 +363,10 @@ static int rockchip_lvds_bind(struct device *dev, struct device *master,
of_property_read_u32(endpoint, "reg", &endpoint_id);
ret = drm_of_find_panel_or_bridge(dev->of_node, 1, endpoint_id,
&lvds->panel, &lvds->bridge);
- if (!ret)
+ if (!ret) {
+ of_node_put(endpoint);
break;
+ }
}
if (!child_count) {
DRM_DEV_ERROR(dev, "lvds port does not have any children\n");
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 5/5] drm/rockchip: lvds: add missing of_node_put
2018-05-23 19:07 ` [PATCH 5/5] drm/rockchip: lvds: " Julia Lawall
@ 2018-06-16 12:24 ` Heiko Stübner
0 siblings, 0 replies; 7+ messages in thread
From: Heiko Stübner @ 2018-06-16 12:24 UTC (permalink / raw)
To: linux-arm-kernel
Hi Julia,
Am Mittwoch, 23. Mai 2018, 21:07:16 CEST schrieb Julia Lawall:
> 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 <Julia.Lawall@lip6.fr>
thanks for catching this. I've added a "Fixes"-tag and
applied the patch to drm-misc-next
Thanks
Heiko
^ permalink raw reply [flat|nested] 7+ messages in thread