lkml.org 
[lkml]   [2020]   [Mar]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] thermal: imx: Add missing of_node_put()
From
Date
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

\
 
 \ /
  Last update: 2020-03-26 15:07    [W:0.038 / U:0.716 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site