| From b648fb551d9c98dc0631adbffce2ff4f6b72d83e Mon Sep 17 00:00:00 2001 |
| From: Anson Huang <Anson.Huang@nxp.com> |
| Date: Thu, 26 Mar 2020 22:29:05 +0800 |
| Subject: [PATCH] thermal/drivers: imx: Fix missing of_node_put() at probe time |
| |
| commit b45fd13be340e4ed0a2a9673ba299eb2a71ba829 upstream. |
| |
| 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> |
| Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> |
| Link: https://lore.kernel.org/r/1585232945-23368-1-git-send-email-Anson.Huang@nxp.com |
| Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> |
| |
| diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c |
| index bb6754a5342c..85511c1160b7 100644 |
| --- a/drivers/thermal/imx_thermal.c |
| +++ b/drivers/thermal/imx_thermal.c |
| @@ -656,7 +656,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) { |
| @@ -671,11 +671,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); |
| - return ret; |
| } |
| } |
| |
| - return 0; |
| + of_node_put(np); |
| + |
| + return ret; |
| } |
| |
| static void imx_thermal_unregister_legacy_cooling(struct imx_thermal_data *data) |
| -- |
| 2.27.0 |
| |