Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] thermal: imx: Add missing of_node_put()
@ 2020-03-26  5:27 Anson Huang
  2020-03-26 14:06 ` Daniel Lezcano
  0 siblings, 1 reply; 3+ messages in thread
From: Anson Huang @ 2020-03-26  5:27 UTC (permalink / raw)
  To: rui.zhang, daniel.lezcano, amit.kucheria, shawnguo, s.hauer,
	kernel, festevam, linux-pm, linux-arm-kernel, linux-kernel
  Cc: Linux-imx

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>
---
 drivers/thermal/imx_thermal.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c
index e761c9b..f7b970d 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,15 @@ 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);
-			return ret;
+			goto put_node;
 		}
 	}
 
-	return 0;
+put_node:
+	if (np)
+		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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] thermal: imx: Add missing of_node_put()
  2020-03-26  5:27 [PATCH] thermal: imx: Add missing of_node_put() Anson Huang
@ 2020-03-26 14:06 ` Daniel Lezcano
  2020-03-26 14:17   ` Anson Huang
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Lezcano @ 2020-03-26 14:06 UTC (permalink / raw)
  To: Anson Huang, rui.zhang, amit.kucheria, shawnguo, s.hauer, kernel,
	festevam, linux-pm, linux-arm-kernel, linux-kernel
  Cc: Linux-imx

On 26/03/2020 06:27, Anson Huang 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> ---
> drivers/thermal/imx_thermal.c | 10 +++++++--- 1 file changed, 7
> insertions(+), 3 deletions(-)
>
> diff --git a/drivers/thermal/imx_thermal.c
> b/drivers/thermal/imx_thermal.c index e761c9b..f7b970d 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,15 @@ 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); -			return
> ret; +			goto put_node; } }
>
> -	return 0; +put_node: +	if (np) +		of_node_put(np);

of_node_put() is already checking if 'np' is NULL.

> + +	return ret; }
>
> static void imx_thermal_unregister_legacy_cooling(struct
> imx_thermal_data *data)
>


-- 
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH] thermal: imx: Add missing of_node_put()
  2020-03-26 14:06 ` Daniel Lezcano
@ 2020-03-26 14:17   ` Anson Huang
  0 siblings, 0 replies; 3+ messages in thread
From: Anson Huang @ 2020-03-26 14:17 UTC (permalink / raw)
  To: Daniel Lezcano, rui.zhang, amit.kucheria, shawnguo, s.hauer,
	kernel, festevam, linux-pm, linux-arm-kernel, linux-kernel
  Cc: dl-linux-imx

Hi, Daniel

> Subject: Re: [PATCH] thermal: imx: Add missing of_node_put()
> 
> On 26/03/2020 06:27, Anson Huang 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> ---
> > drivers/thermal/imx_thermal.c | 10 +++++++--- 1 file changed, 7
> > insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/thermal/imx_thermal.c
> > b/drivers/thermal/imx_thermal.c index e761c9b..f7b970d 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,15 @@ 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); -
> 	return
> > ret; +			goto put_node; } }
> >
> > -	return 0; +put_node: +	if (np) +		of_node_put(np);
> 
> of_node_put() is already checking if 'np' is NULL.

OK, I will remove the checking of if 'np' is NULL.

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-26  5:27 [PATCH] thermal: imx: Add missing of_node_put() Anson Huang
2020-03-26 14:06 ` Daniel Lezcano
2020-03-26 14:17   ` Anson Huang

Linux-ARM-Kernel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-arm-kernel/0 linux-arm-kernel/git/0.git
	git clone --mirror https://lore.kernel.org/linux-arm-kernel/1 linux-arm-kernel/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-arm-kernel linux-arm-kernel/ https://lore.kernel.org/linux-arm-kernel \
		linux-arm-kernel@lists.infradead.org
	public-inbox-index linux-arm-kernel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.infradead.lists.linux-arm-kernel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git