linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anson Huang <anson.huang@nxp.com>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: "linux@armlinux.org.uk" <linux@armlinux.org.uk>,
	"shawnguo@kernel.org" <shawnguo@kernel.org>,
	"s.hauer@pengutronix.de" <s.hauer@pengutronix.de>,
	"kernel@pengutronix.de" <kernel@pengutronix.de>,
	"festevam@gmail.com" <festevam@gmail.com>,
	"allison@lohutok.net" <allison@lohutok.net>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"andrew.smirnov@gmail.com" <andrew.smirnov@gmail.com>,
	"kstewart@linuxfoundation.org" <kstewart@linuxfoundation.org>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"rfontana@redhat.com" <rfontana@redhat.com>,
	"sakari.ailus@linux.intel.com" <sakari.ailus@linux.intel.com>,
	"bhelgaas@google.com" <bhelgaas@google.com>,
	"dsterba@suse.com" <dsterba@suse.com>,
	Peng Fan <peng.fan@nxp.com>,
	"okuno.kohji@jp.panasonic.com" <okuno.kohji@jp.panasonic.com>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	dl-linux-imx <linux-imx@nxp.com>
Subject: RE: [PATCH V2] ARM: imx: Add missing of_node_put()
Date: Thu, 13 Feb 2020 08:41:17 +0000	[thread overview]
Message-ID: <DB3PR0402MB3916D1A18B80F35B9F86563CF51A0@DB3PR0402MB3916.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <20200213081825.mox35tzizscdk7km@pengutronix.de>

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

      reply	other threads:[~2020-02-13  8:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-13  6:20 [PATCH V2] ARM: imx: Add missing of_node_put() Anson Huang
2020-02-13  8:18 ` Uwe Kleine-König
2020-02-13  8:41   ` Anson Huang [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DB3PR0402MB3916D1A18B80F35B9F86563CF51A0@DB3PR0402MB3916.eurprd04.prod.outlook.com \
    --to=anson.huang@nxp.com \
    --cc=allison@lohutok.net \
    --cc=andrew.smirnov@gmail.com \
    --cc=bhelgaas@google.com \
    --cc=dsterba@suse.com \
    --cc=festevam@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel@pengutronix.de \
    --cc=kstewart@linuxfoundation.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=okuno.kohji@jp.panasonic.com \
    --cc=peng.fan@nxp.com \
    --cc=rfontana@redhat.com \
    --cc=s.hauer@pengutronix.de \
    --cc=sakari.ailus@linux.intel.com \
    --cc=shawnguo@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=u.kleine-koenig@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).