All of lore.kernel.org
 help / color / mirror / Atom feed
From: Amit Kucheria <amit.kucheria@verdurent.com>
To: Anson Huang <Anson.Huang@nxp.com>
Cc: Zhang Rui <rui.zhang@intel.com>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	Shawn Guo <shawnguo@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	kernel@pengutronix.de, Fabio Estevam <festevam@gmail.com>,
	Linux PM list <linux-pm@vger.kernel.org>,
	lakml <linux-arm-kernel@lists.infradead.org>,
	LKML <linux-kernel@vger.kernel.org>,
	dl-linux-imx <Linux-imx@nxp.com>
Subject: Re: [PATCH V2] thermal: imx: Add missing of_node_put()
Date: Wed, 29 Apr 2020 01:58:56 +0530	[thread overview]
Message-ID: <CAHLCerP7O19cRsK6OfmGm89K7KefRQnCUdNCNQM8mEAbycUjbg@mail.gmail.com> (raw)
In-Reply-To: <1585232945-23368-1-git-send-email-Anson.Huang@nxp.com>

On Thu, Mar 26, 2020 at 8:06 PM Anson Huang <Anson.Huang@nxp.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@nxp.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?

> -                       return ret;
>                 }
>         }
>
> -       return 0;
> +       of_node_put(np);
> +
> +       return ret;
>  }
>
>  static void imx_thermal_unregister_legacy_cooling(struct imx_thermal_data *data)
> --
> 2.7.4
>

WARNING: multiple messages have this Message-ID (diff)
From: Amit Kucheria <amit.kucheria@verdurent.com>
To: Anson Huang <Anson.Huang@nxp.com>
Cc: Linux PM list <linux-pm@vger.kernel.org>,
	Shawn Guo <shawnguo@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	LKML <linux-kernel@vger.kernel.org>,
	dl-linux-imx <Linux-imx@nxp.com>,
	kernel@pengutronix.de, Zhang Rui <rui.zhang@intel.com>,
	Fabio Estevam <festevam@gmail.com>,
	lakml <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH V2] thermal: imx: Add missing of_node_put()
Date: Wed, 29 Apr 2020 01:58:56 +0530	[thread overview]
Message-ID: <CAHLCerP7O19cRsK6OfmGm89K7KefRQnCUdNCNQM8mEAbycUjbg@mail.gmail.com> (raw)
In-Reply-To: <1585232945-23368-1-git-send-email-Anson.Huang@nxp.com>

On Thu, Mar 26, 2020 at 8:06 PM Anson Huang <Anson.Huang@nxp.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@nxp.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?

> -                       return ret;
>                 }
>         }
>
> -       return 0;
> +       of_node_put(np);
> +
> +       return ret;
>  }
>
>  static void imx_thermal_unregister_legacy_cooling(struct imx_thermal_data *data)
> --
> 2.7.4
>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2020-04-28 20:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-26 14:29 [PATCH V2] thermal: imx: Add missing of_node_put() Anson Huang
2020-03-26 14:29 ` Anson Huang
2020-04-28 20:28 ` Amit Kucheria [this message]
2020-04-28 20:28   ` Amit Kucheria
2020-04-29  2:00   ` Anson Huang
2020-04-29  2:00     ` Anson Huang

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=CAHLCerP7O19cRsK6OfmGm89K7KefRQnCUdNCNQM8mEAbycUjbg@mail.gmail.com \
    --to=amit.kucheria@verdurent.com \
    --cc=Anson.Huang@nxp.com \
    --cc=Linux-imx@nxp.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=festevam@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.