[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <DB3PR0402MB3916E5752413D058A5177820F5AD0@DB3PR0402MB3916.eurprd04.prod.outlook.com>
Date: Wed, 29 Apr 2020 02:00:23 +0000
From: Anson Huang <anson.huang@....com>
To: Amit Kucheria <amit.kucheria@...durent.com>
CC: Zhang Rui <rui.zhang@...el.com>,
Daniel Lezcano <daniel.lezcano@...aro.org>,
Shawn Guo <shawnguo@...nel.org>,
Sascha Hauer <s.hauer@...gutronix.de>,
"kernel@...gutronix.de" <kernel@...gutronix.de>,
Fabio Estevam <festevam@...il.com>,
Linux PM list <linux-pm@...r.kernel.org>,
lakml <linux-arm-kernel@...ts.infradead.org>,
LKML <linux-kernel@...r.kernel.org>,
dl-linux-imx <linux-imx@....com>
Subject: RE: [PATCH V2] thermal: imx: Add missing of_node_put()
Hi, Amit
> Subject: Re: [PATCH V2] thermal: imx: Add missing of_node_put()
>
> On Thu, Mar 26, 2020 at 8:06 PM Anson Huang <Anson.Huang@....com>
> wrote:
> >
> > After finishing using cpu node got from of_get_cpu_node(),
> > of_node_put() needs to be called.
> >
> > Signed-off-by: Anson Huang <Anson.Huang@....com>
> > ---
> > Changes since V1:
> > - improve the logic, no need to use got.
> > ---
> > drivers/thermal/imx_thermal.c | 7 ++++---
> > 1 file changed, 4 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/thermal/imx_thermal.c
> > b/drivers/thermal/imx_thermal.c index e761c9b..1b84ea6 100644
> > --- a/drivers/thermal/imx_thermal.c
> > +++ b/drivers/thermal/imx_thermal.c
> > @@ -649,7 +649,7 @@ MODULE_DEVICE_TABLE(of,
> of_imx_thermal_match);
> > static int imx_thermal_register_legacy_cooling(struct imx_thermal_data
> > *data) {
> > struct device_node *np;
> > - int ret;
> > + int ret = 0;
> >
> > data->policy = cpufreq_cpu_get(0);
> > if (!data->policy) {
> > @@ -664,11 +664,12 @@ static int
> imx_thermal_register_legacy_cooling(struct imx_thermal_data *data)
> > if (IS_ERR(data->cdev)) {
> > ret = PTR_ERR(data->cdev);
> > cpufreq_cpu_put(data->policy);
>
> You could move this policy release outside the if block too, no?
Looks like yes, the policy can be put before function return anyway, I will do it in V3.
Thanks,
Anson
Powered by blists - more mailing lists