Skip to contentSkip to conversation

thermal: imx: Add missing of_node_put()

PATCH In review Anson Huang 2 participants 3 messages Apr 29, 2020 – May 24, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 thermal: imx: Add missing of_node_put()

After finishing using cpu node got from of_get_cpu_node(), of_node_put() needs to be called, the cpufreq policy also needs to be put unconditionally.

---
Changes since V2:
- call cpufreq_cpu_put() unconditionally after cooling register done.

---
 drivers/thermal/imx_thermal.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/thermal/imx_thermal.c +6 -7
index e761c9b..8764cb5 100644
@@ -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) {
@@ -661,20 +661,19 @@ static int imx_thermal_register_legacy_cooling(struct imx_thermal_data *data)
 
 	if (!np || !of_find_property(np, "#cooling-cells", NULL)) {
 		data->cdev = cpufreq_cooling_register(data->policy);
-		if (IS_ERR(data->cdev)) {
+		if (IS_ERR(data->cdev))
 			ret = PTR_ERR(data->cdev);
-			cpufreq_cpu_put(data->policy);
-			return ret;
-		}
 	}
 
-	return 0;
+	cpufreq_cpu_put(data->policy);
+	of_node_put(np);
+
+	return ret;
 }
 
 static void imx_thermal_unregister_legacy_cooling(struct imx_thermal_data *data)
 {
 	cpufreq_cooling_unregister(data->cdev);
-	cpufreq_cpu_put(data->policy);
 }
 
 #else
Signature · 1 line
2.7.4
#1 lore raw

Gentle ping...

Quoted 55 lines

Subject: [PATCH V3] thermal: imx: Add missing of_node_put()

After finishing using cpu node got from of_get_cpu_node(), of_node_put() needs to be called, the cpufreq policy also needs to be put unconditionally.

---
Changes since V2:
- call cpufreq_cpu_put() unconditionally after cooling register done.

---
 drivers/thermal/imx_thermal.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/thermal/imx_thermal.c +6 -7
index e761c9b..8764cb5 100644
@@ -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) {
@@ -661,20 +661,19 @@ static int
 imx_thermal_register_legacy_cooling(struct imx_thermal_data *data)
 
 	if (!np || !of_find_property(np, "#cooling-cells", NULL)) {
 		data->cdev = cpufreq_cooling_register(data->policy);
-		if (IS_ERR(data->cdev)) {
+		if (IS_ERR(data->cdev))
 			ret = PTR_ERR(data->cdev);
-			cpufreq_cpu_put(data->policy);
-			return ret;
-		}
 	}
 
-	return 0;
+	cpufreq_cpu_put(data->policy);
+	of_node_put(np);
+
+	return ret;
 }
 
 static void imx_thermal_unregister_legacy_cooling(struct imx_thermal_data
 *data)  {
 	cpufreq_cooling_unregister(data->cdev);
-	cpufreq_cpu_put(data->policy);
 }
 

#else
--
2.7.4

#2 lore raw
Quoted 1 line · Anson Huang

Gentle ping...

It is applied, sorry for not letting you know.

Quoted 56 lines
Quoted 55 lines

Subject: [PATCH V3] thermal: imx: Add missing of_node_put()

After finishing using cpu node got from of_get_cpu_node(), of_node_put() needs to be called, the cpufreq policy also needs to be put unconditionally.

---
Changes since V2:
- call cpufreq_cpu_put() unconditionally after cooling register done.

---
 drivers/thermal/imx_thermal.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/thermal/imx_thermal.c +6 -7
index e761c9b..8764cb5 100644
@@ -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) {
@@ -661,20 +661,19 @@ static int
 imx_thermal_register_legacy_cooling(struct imx_thermal_data *data)
 
 	if (!np || !of_find_property(np, "#cooling-cells", NULL)) {
 		data->cdev = cpufreq_cooling_register(data->policy);
-		if (IS_ERR(data->cdev)) {
+		if (IS_ERR(data->cdev))
 			ret = PTR_ERR(data->cdev);
-			cpufreq_cpu_put(data->policy);
-			return ret;
-		}
 	}
 
-	return 0;
+	cpufreq_cpu_put(data->policy);
+	of_node_put(np);
+
+	return ret;
 }
 
 static void imx_thermal_unregister_legacy_cooling(struct imx_thermal_data
 *data)  {
 	cpufreq_cooling_unregister(data->cdev);
-	cpufreq_cpu_put(data->policy);
 }
 

#else
--
2.7.4

Signature · 5 lines
<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