lkml.org 
[lkml]   [2020]   [Feb]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH V2] ARM: imx: Add missing of_node_put()
Date
Hi, Uwe

> Subject: Re: [PATCH V2] ARM: imx: Add missing of_node_put()
>
> On Thu, Feb 13, 2020 at 02:20:54PM +0800, Anson Huang wrote:
> > After finishing using device node got from of_find_compatible_node(),
> > of_node_put() needs to be called.
> >
> > Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
> > ---
> > Changes since V1:
> > - correct some of_node_put() place to make sure it is safe to be put.
> > ---
> > arch/arm/mach-imx/anatop.c | 3 +++
> > arch/arm/mach-imx/gpc.c | 1 +
> > arch/arm/mach-imx/platsmp.c | 1 +
> > arch/arm/mach-imx/pm-imx6.c | 2 ++
> > arch/arm/mach-imx/pm-imx7ulp.c | 1 +
> > 5 files changed, 8 insertions(+)
> >
> > diff --git a/arch/arm/mach-imx/anatop.c b/arch/arm/mach-imx/anatop.c
> > index 8fb68c0..5985731 100644
> > --- a/arch/arm/mach-imx/anatop.c
> > +++ b/arch/arm/mach-imx/anatop.c
> > @@ -135,6 +135,7 @@ void __init imx_init_revision_from_anatop(void)
> > void __iomem *src_base;
> > u32 sbmr2;
> >
> > + of_node_put(np);
> > np = of_find_compatible_node(NULL, NULL,
> > "fsl,imx6ul-src");
> > src_base = of_iomap(np, 0);
> > @@ -152,6 +153,8 @@ void __init imx_init_revision_from_anatop(void)
> >
> > mxc_set_cpu_type(digprog >> 16 & 0xff);
> > imx_set_soc_revision(revision);
> > +
> > + of_node_put(np);
> > }
>
> It would be a bit more natural here IMHO to introduce a second struct
> device_node * variable for the fsl,imx6ul-src device. Then each of_node_put
> would belong to exactly one of_find_compatible_node().
> (Now the of_node_put() in line 157 frees the fsl,imx6ul-src on i.MX6ULL and
> fsl,imx6q-anatop on the others.)

Make sense, please help review V3.
Thanks,
Anson
\
 
 \ /
  Last update: 2020-02-13 09:43    [W:0.058 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site