Skip to contentSkip to conversation

thermal/drivers/tegra: Fix crash when getting critical temp

PATCH Applied Jon Hunter 3 participants 5 messages Oct 10, 2022 – Dec 9, 2022

Subsystems (2)
lore
Share & tools
lore

Jon Hunter

author maintainer
#0 lore raw

PATCH 1/1 thermal/drivers/tegra: Fix crash when getting critical temp

Commit 13bea86623be ("thermal/of: Remove of_thermal_get_crit_temp()") removed the function of_thermal_get_crit_temp() and this is causing a NULL pointer deference crash when attempting to call the 'get_crit_temp' function pointer because this function pointer is no longer initialised. Fix this by replacing the call to the 'get_crit_temp' function pointer with a call to the function thermal_zone_get_crit_temp() instead.

Fixes 13bea86623be ("thermal/of: Remove of_thermal_get_crit_temp()")
---
 drivers/thermal/tegra/soctherm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/tegra/soctherm.c +1 -1
index d2e454902689..4203e74e2f79 100644
@@ -742,7 +742,7 @@ static int tegra_soctherm_set_hwtrips(struct device *dev,
 	/* Get thermtrips. If missing, try to get critical trips. */
 	temperature = tsensor_group_thermtrip_get(ts, sg->id);
 	if (min_low_temp == temperature)
-		if (tz->ops->get_crit_temp(tz, &temperature))
+		if (thermal_zone_get_crit_temp(tz, &temperature))
 			temperature = max_high_temp;
 
 	ret = thermtrip_program(dev, sg, temperature);
Signature · 1 line
2.25.1
author maintainer
#1 lore raw

Hi Rafael,

Quoted 18 lines · Jon Hunter

Commit 13bea86623be ("thermal/of: Remove of_thermal_get_crit_temp()") removed the function of_thermal_get_crit_temp() and this is causing a NULL pointer deference crash when attempting to call the 'get_crit_temp' function pointer because this function pointer is no longer initialised. Fix this by replacing the call to the 'get_crit_temp' function pointer with a call to the function thermal_zone_get_crit_temp() instead.

Fixes 13bea86623be ("thermal/of: Remove of_thermal_get_crit_temp()")
---
  drivers/thermal/tegra/soctherm.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/tegra/soctherm.c +0 -0
index d2e454902689..4203e74e2f79 100644

drivers/thermal/tegra/soctherm.c static int tegra_soctherm_set_hwtrips(struct device *dev, · line 748

Quoted 8 lines
drivers/thermal/tegra/soctherm.c +1 -1
@@ -742,7 +742,7 @@ static int tegra_soctherm_set_hwtrips(struct device *dev,
  	/* Get thermtrips. If missing, try to get critical trips. */
  	temperature = tsensor_group_thermtrip_get(ts, sg->id);
  	if (min_low_temp == temperature)
-		if (tz->ops->get_crit_temp(tz, &temperature))
+		if (thermal_zone_get_crit_temp(tz, &temperature))
  			temperature = max_high_temp;
 
  	ret = thermtrip_program(dev, sg, temperature);

Any feedback on this? OK to take this fix?

Thanks
Jon

Signature · 1 line
nvpublic
#2 lore raw
Quoted 16 lines · Jon Hunter

Hi Rafael,

Quoted 13 lines · Jon Hunter

Commit 13bea86623be ("thermal/of: Remove of_thermal_get_crit_temp()") removed the function of_thermal_get_crit_temp() and this is causing a NULL pointer deference crash when attempting to call the 'get_crit_temp' function pointer because this function pointer is no longer initialised. Fix this by replacing the call to the 'get_crit_temp' function pointer with a call to the function thermal_zone_get_crit_temp() instead.

Fixes 13bea86623be ("thermal/of: Remove of_thermal_get_crit_temp()")

---
  drivers/thermal/tegra/soctherm.c | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 14 lines

drivers/thermal/tegra/soctherm.c static int tegra_soctherm_set_hwtrips(struct · line 748

Quoted 13 lines
drivers/thermal/tegra/soctherm.c +1 -1
index d2e454902689..4203e74e2f79 100644
@@ -742,7 +742,7 @@ static int tegra_soctherm_set_hwtrips(struct 
 device *dev,
       /* Get thermtrips. If missing, try to get critical trips. */
       temperature = tsensor_group_thermtrip_get(ts, sg->id);
       if (min_low_temp == temperature)
-        if (tz->ops->get_crit_temp(tz, &temperature))
+        if (thermal_zone_get_crit_temp(tz, &temperature))
               temperature = max_high_temp;
       ret = thermtrip_program(dev, sg, temperature);

I'll take it

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
#3 lore raw
In reply to Jon Hunter
Quoted 10 lines · Jon Hunter

Commit 13bea86623be ("thermal/of: Remove of_thermal_get_crit_temp()") removed the function of_thermal_get_crit_temp() and this is causing a NULL pointer deference crash when attempting to call the 'get_crit_temp' function pointer because this function pointer is no longer initialised. Fix this by replacing the call to the 'get_crit_temp' function pointer with a call to the function thermal_zone_get_crit_temp() instead.

Fixes 13bea86623be ("thermal/of: Remove of_thermal_get_crit_temp()")

---

Applied, thanks

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
merge bot Applied
#4 lore raw
In reply to Jon Hunter
The following commit has been merged into the thermal/next branch of thermal:

The following commit has been merged into the thermal/next branch of thermal:

Commit-ID:     340e74d08972239f8ec6ad3bed706b360162f293
Gitweb:        https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git//340e74d08972239f8ec6ad3bed706b360162f293
Author:        Jon Hunter <[email protected]>
AuthorDate:    Mon, 10 Oct 2022 16:03:11 +01:00
Committer:     Daniel Lezcano <[email protected]>
CommitterDate: Thu, 08 Dec 2022 14:30:43 +01:00

thermal/drivers/tegra: Fix crash when getting critical temp

Commit 13bea86623be ("thermal/of: Remove of_thermal_get_crit_temp()") removed the function of_thermal_get_crit_temp() and this is causing a NULL pointer deference crash when attempting to call the 'get_crit_temp' function pointer because this function pointer is no longer initialised. Fix this by replacing the call to the 'get_crit_temp' function pointer with a call to the function thermal_zone_get_crit_temp() instead.

Fixes 13bea86623be ("thermal/of: Remove of_thermal_get_crit_temp()")
---
 drivers/thermal/tegra/soctherm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/tegra/soctherm.c +1 -1
index d2e4549..4203e74 100644
@@ -742,7 +742,7 @@ static int tegra_soctherm_set_hwtrips(struct device *dev,
 	/* Get thermtrips. If missing, try to get critical trips. */
 	temperature = tsensor_group_thermtrip_get(ts, sg->id);
 	if (min_low_temp == temperature)
-		if (tz->ops->get_crit_temp(tz, &temperature))
+		if (thermal_zone_get_crit_temp(tz, &temperature))
 			temperature = max_high_temp;
 
 	ret = thermtrip_program(dev, sg, temperature);