public inbox for linux-rockchip@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH 0/5] add missing of_node_put
@ 2018-05-23 19:07 Julia Lawall
  2018-05-23 19:07 ` [PATCH 5/5] drm/rockchip: lvds: " Julia Lawall
  0 siblings, 1 reply; 3+ messages in thread
From: Julia Lawall @ 2018-05-23 19:07 UTC (permalink / raw)
  To: linux-pci
  Cc: linux-rockchip, kernel-janitors, linux-kernel, dri-devel,
	linux-gpio, linuxppc-dev, 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.

---

 drivers/gpu/drm/rockchip/rockchip_lvds.c   |    4 +++-
 drivers/pci/hotplug/pnv_php.c              |    8 ++++++--
 drivers/phy/hisilicon/phy-hisi-inno-usb2.c |    9 +++++++--
 drivers/pinctrl/pinctrl-at91-pio4.c        |    4 +++-
 drivers/soc/ti/knav_dma.c                  |    1 +
 5 files changed, 20 insertions(+), 6 deletions(-)
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 3+ 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 ` Julia Lawall
  2018-06-16 12:24   ` Heiko Stübner
  0 siblings, 1 reply; 3+ messages in thread
From: Julia Lawall @ 2018-05-23 19:07 UTC (permalink / raw)
  To: Sandy Huang
  Cc: David Airlie, kernel-janitors, linux-kernel, dri-devel,
	linux-rockchip, 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");

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [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; 3+ messages in thread
From: Heiko Stübner @ 2018-06-16 12:24 UTC (permalink / raw)
  To: Julia Lawall
  Cc: David Airlie, kernel-janitors, dri-devel, linux-kernel,
	linux-rockchip, 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


_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2018-06-16 12:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-23 19:07 [PATCH 0/5] add missing of_node_put Julia Lawall
2018-05-23 19:07 ` [PATCH 5/5] drm/rockchip: lvds: " Julia Lawall
2018-06-16 12:24   ` Heiko Stübner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox