* [PATCH 0/4] add missing of_node_puts
@ 2019-01-13 8:47 Julia Lawall
2019-01-13 8:47 ` [PATCH 3/4] drm/rockchip: add missing of_node_put Julia Lawall
0 siblings, 1 reply; 5+ messages in thread
From: Julia Lawall @ 2019-01-13 8:47 UTC (permalink / raw)
To: linux-rockchip
Cc: David Airlie, kernel-janitors, linux-kernel, dri-devel,
linux-mediatek, 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 patches for drivers/gpu/drm/imx/imx-ldb.c and
drivers/gpu/drm/sun4i/sun4i_backend.c contain some added of_node_puts for
which the need was identified manually. Details are in the patch logs.
---
drivers/gpu/drm/imx/imx-ldb.c | 25 +++++++++++++++++--------
drivers/gpu/drm/mediatek/mtk_drm_drv.c | 5 ++++-
drivers/gpu/drm/rockchip/rockchip_rgb.c | 4 +++-
drivers/gpu/drm/sun4i/sun4i_backend.c | 1 +
4 files changed, 25 insertions(+), 10 deletions(-)
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 3/4] drm/rockchip: add missing of_node_put
2019-01-13 8:47 [PATCH 0/4] add missing of_node_puts Julia Lawall
@ 2019-01-13 8:47 ` Julia Lawall
2019-01-13 18:48 ` Heiko Stuebner
0 siblings, 1 reply; 5+ messages in thread
From: Julia Lawall @ 2019-01-13 8:47 UTC (permalink / raw)
To: Sandy Huang
Cc: kernel-janitors, Heiko Stübner, David Airlie, Daniel Vetter,
dri-devel, linux-arm-kernel, linux-rockchip, linux-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_rgb.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/rockchip/rockchip_rgb.c b/drivers/gpu/drm/rockchip/rockchip_rgb.c
index 96ac145..37f9302 100644
--- a/drivers/gpu/drm/rockchip/rockchip_rgb.c
+++ b/drivers/gpu/drm/rockchip/rockchip_rgb.c
@@ -113,8 +113,10 @@ struct rockchip_rgb *rockchip_rgb_init(struct device *dev,
child_count++;
ret = drm_of_find_panel_or_bridge(dev->of_node, 0, endpoint_id,
&panel, &bridge);
- if (!ret)
+ if (!ret) {
+ of_node_put(endpoint);
break;
+ }
}
of_node_put(port);
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH 3/4] drm/rockchip: add missing of_node_put
2019-01-13 8:47 ` [PATCH 3/4] drm/rockchip: add missing of_node_put Julia Lawall
@ 2019-01-13 18:48 ` Heiko Stuebner
2019-01-14 10:05 ` Daniel Vetter
0 siblings, 1 reply; 5+ messages in thread
From: Heiko Stuebner @ 2019-01-13 18:48 UTC (permalink / raw)
To: Julia Lawall
Cc: David Airlie, kernel-janitors, dri-devel, linux-kernel,
linux-rockchip, linux-arm-kernel
Am Sonntag, 13. Januar 2019, 09:47:43 CET 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>
I've added a fixes+stable tag and applied it to drm-misc-fixes
Thanks for catching that
Heiko
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH 3/4] drm/rockchip: add missing of_node_put
2019-01-13 18:48 ` Heiko Stuebner
@ 2019-01-14 10:05 ` Daniel Vetter
2019-01-14 10:09 ` Heiko Stuebner
0 siblings, 1 reply; 5+ messages in thread
From: Daniel Vetter @ 2019-01-14 10:05 UTC (permalink / raw)
To: Heiko Stuebner
Cc: linux-rockchip, David Airlie, kernel-janitors, dri-devel,
linux-kernel, Julia Lawall, linux-arm-kernel
On Sun, Jan 13, 2019 at 07:48:49PM +0100, Heiko Stuebner wrote:
> Am Sonntag, 13. Januar 2019, 09:47:43 CET 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>
>
> I've added a fixes+stable tag and applied it to drm-misc-fixes
All of them or just this one here? These cleanup patches have a high
chance of falling through cracks, so taking them all usually works out
better ...
-Daniel
>
> Thanks for catching that
> Heiko
>
>
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH 3/4] drm/rockchip: add missing of_node_put
2019-01-14 10:05 ` Daniel Vetter
@ 2019-01-14 10:09 ` Heiko Stuebner
0 siblings, 0 replies; 5+ messages in thread
From: Heiko Stuebner @ 2019-01-14 10:09 UTC (permalink / raw)
To: Daniel Vetter
Cc: linux-rockchip, David Airlie, kernel-janitors, dri-devel,
linux-kernel, Julia Lawall, linux-arm-kernel
Am Montag, 14. Januar 2019, 11:05:56 CET schrieb Daniel Vetter:
> On Sun, Jan 13, 2019 at 07:48:49PM +0100, Heiko Stuebner wrote:
> > Am Sonntag, 13. Januar 2019, 09:47:43 CET 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>
> >
> > I've added a fixes+stable tag and applied it to drm-misc-fixes
>
> All of them or just this one here? These cleanup patches have a high
> chance of falling through cracks, so taking them all usually works out
> better ...
That is the only one I got, so right now I only applied this one in my inbox.
Weekend and such resulted in me not going looking for other ones.
Heiko
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-01-14 10:09 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-13 8:47 [PATCH 0/4] add missing of_node_puts Julia Lawall
2019-01-13 8:47 ` [PATCH 3/4] drm/rockchip: add missing of_node_put Julia Lawall
2019-01-13 18:48 ` Heiko Stuebner
2019-01-14 10:05 ` Daniel Vetter
2019-01-14 10:09 ` Heiko Stuebner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox