diff mbox series

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

Message ID 20221010150311.40384-1-jonathanh@nvidia.com
State Accepted
Commit 5f28ecc1e909b2c3ab6ba4e9ba57c0f8dc66c30f
Headers show
Series thermal/drivers/tegra: Fix crash when getting critical temp | expand

Commit Message

Jon Hunter Oct. 10, 2022, 3:03 p.m. UTC
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()")
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
---
 drivers/thermal/tegra/soctherm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jon Hunter Oct. 21, 2022, 9:49 a.m. UTC | #1
Hi Rafael,

On 10/10/2022 16:03, Jon Hunter wrote:
> 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()")
> Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
> ---
>   drivers/thermal/tegra/soctherm.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/thermal/tegra/soctherm.c b/drivers/thermal/tegra/soctherm.c
> index d2e454902689..4203e74e2f79 100644
> --- a/drivers/thermal/tegra/soctherm.c
> +++ b/drivers/thermal/tegra/soctherm.c
> @@ -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
diff mbox series

Patch

diff --git a/drivers/thermal/tegra/soctherm.c b/drivers/thermal/tegra/soctherm.c
index d2e454902689..4203e74e2f79 100644
--- a/drivers/thermal/tegra/soctherm.c
+++ b/drivers/thermal/tegra/soctherm.c
@@ -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);