[PATCH] drm:pl111: Add of_node_put() when breaking out of for_each_available_child_of_node()

Daniel Vetter daniel at ffwll.ch
Thu Aug 11 16:13:44 UTC 2022


On Wed, Aug 10, 2022 at 01:35:36PM -0600, Rob Herring wrote:
> On Wed, Aug 10, 2022 at 10:37 AM Daniel Vetter <daniel at ffwll.ch> wrote:
> >
> > On Mon, Jul 11, 2022 at 09:15:50PM +0800, Liang He wrote:
> > > The reference 'child' in the iteration of for_each_available_child_of_node()
> > > is only escaped out into a local variable which is only used to check
> > > its value. So we still need to the of_node_put() when breaking of the
> > > for_each_available_child_of_node() which will automatically increase
> > > and decrease the refcount.
> > >
> > > Fixes: ca454bd42dc2 ("drm/pl111: Support the Versatile Express")
> > > Signed-off-by: Liang He <windhl at 126.com>
> > > ---
> > >
> > > As 'Check-after-Put' has been widely accepted in kernel source, we just
> > > use it. If the maintainer thinks it is harmful, I'd like also to use
> > > 'Check-and-Put' coding style but with a bit more work.
> > >
> > >  drivers/gpu/drm/pl111/pl111_versatile.c | 1 +
> > >  1 file changed, 1 insertion(+)
> > >
> > > diff --git a/drivers/gpu/drm/pl111/pl111_versatile.c b/drivers/gpu/drm/pl111/pl111_versatile.c
> > > index bdd883f4f0da..963a5d5e6987 100644
> > > --- a/drivers/gpu/drm/pl111/pl111_versatile.c
> > > +++ b/drivers/gpu/drm/pl111/pl111_versatile.c
> > > @@ -402,6 +402,7 @@ static int pl111_vexpress_clcd_init(struct device *dev, struct device_node *np,
> > >               if (of_device_is_compatible(child, "arm,pl111")) {
> > >                       has_coretile_clcd = true;
> > >                       ct_clcd = child;
> > > +                     of_node_put(child);
> >
> > The same issue seems to exist right below in the next break? Can you pls
> > respin with that included?
> 
> It has a put already.
> 
> Reviewed-by: Rob Herring <robh at kernel.org>

Huh I was blind.

Thanks for patch&review, pushed to drm-misc-next.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the dri-devel mailing list