diff mbox series

[SRU,M:raspi] UBUNTU: driver: thermal: step_wise: Fix uninitialized variable

Message ID 20231117135018.568051-1-juerg.haefliger@canonical.com
State New
Headers show
Series [SRU,M:raspi] UBUNTU: driver: thermal: step_wise: Fix uninitialized variable | expand

Commit Message

Juerg Haefliger Nov. 17, 2023, 1:50 p.m. UTC
BugLink: https://bugs.launchpad.net/bugs/2041741

A bad forward port of a pi-specific commit dropped the initialization
of the trip_temp variable which results in the fan always spinning at
full speed. Fix that.

While at it, drop the second (unnecessary/benign) call of get_tz_trend()
to match rpi-6.5.y.

Fixes: f6264057efc8 ("drivers: thermal: step_wise: avoid throttling at hysteresis temperature after dropping below it")
Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
---
 drivers/thermal/gov_step_wise.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Tim Gardner Nov. 17, 2023, 3:02 p.m. UTC | #1
On 11/17/23 6:50 AM, Juerg Haefliger wrote:
> BugLink: https://bugs.launchpad.net/bugs/2041741
> 
> A bad forward port of a pi-specific commit dropped the initialization
> of the trip_temp variable which results in the fan always spinning at
> full speed. Fix that.
> 
> While at it, drop the second (unnecessary/benign) call of get_tz_trend()
> to match rpi-6.5.y.
> 
> Fixes: f6264057efc8 ("drivers: thermal: step_wise: avoid throttling at hysteresis temperature after dropping below it")
> Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
> ---
>   drivers/thermal/gov_step_wise.c | 4 +---
>   1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/thermal/gov_step_wise.c b/drivers/thermal/gov_step_wise.c
> index cf5c725660ce..eefeb6407d0f 100644
> --- a/drivers/thermal/gov_step_wise.c
> +++ b/drivers/thermal/gov_step_wise.c
> @@ -98,15 +98,13 @@ static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip_id
>   		trace_thermal_zone_trip(tz, trip_id, trip.type);
>   	}
>   
> -	hyst_temp = trip.temperature;
> +	hyst_temp = trip_temp = trip.temperature;
>   	if (tz->ops->get_trip_hyst) {
>   		tz->ops->get_trip_hyst(tz, trip_id, &hyst_temp);
>   		hyst_temp = trip_temp - hyst_temp;
>   	}
>   	trip_type = trip.type;
>   
> -	trend = get_tz_trend(tz, trip_id);
> -
>   	dev_dbg(&tz->device,
>   		"Trip%d[type=%d,temp=%d,hyst=%d]:trend=%d,throttle=%d\n",
>   		trip_id, trip_type, trip.temperature, hyst_temp, trend, throttle);
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Agathe Porte Nov. 17, 2023, 3:08 p.m. UTC | #2
On 11/17/23 14:50, Juerg Haefliger wrote:
> BugLink: https://bugs.launchpad.net/bugs/2041741
>
> A bad forward port of a pi-specific commit dropped the initialization
> of the trip_temp variable which results in the fan always spinning at
> full speed. Fix that.
>
> While at it, drop the second (unnecessary/benign) call of get_tz_trend()
> to match rpi-6.5.y.
>
> Fixes: f6264057efc8 ("drivers: thermal: step_wise: avoid throttling at hysteresis temperature after dropping below it")
> Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
> ---
>   drivers/thermal/gov_step_wise.c | 4 +---
>   1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/thermal/gov_step_wise.c b/drivers/thermal/gov_step_wise.c
> index cf5c725660ce..eefeb6407d0f 100644
> --- a/drivers/thermal/gov_step_wise.c
> +++ b/drivers/thermal/gov_step_wise.c
> @@ -98,15 +98,13 @@ static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip_id
>   		trace_thermal_zone_trip(tz, trip_id, trip.type);
>   	}
>   
> -	hyst_temp = trip.temperature;
> +	hyst_temp = trip_temp = trip.temperature;
>   	if (tz->ops->get_trip_hyst) {
>   		tz->ops->get_trip_hyst(tz, trip_id, &hyst_temp);
>   		hyst_temp = trip_temp - hyst_temp;
>   	}
>   	trip_type = trip.type;
>   
> -	trend = get_tz_trend(tz, trip_id);
> -
>   	dev_dbg(&tz->device,
>   		"Trip%d[type=%d,temp=%d,hyst=%d]:trend=%d,throttle=%d\n",
>   		trip_id, trip_type, trip.temperature, hyst_temp, trend, throttle);
Acked-by: Agathe Porte <agathe.porte@canonical.com>
Juerg Haefliger Nov. 20, 2023, 8:03 a.m. UTC | #3
Applied to Mantic linux-raspi master-next branch.

...Juerg


> BugLink: https://bugs.launchpad.net/bugs/2041741
> 
> A bad forward port of a pi-specific commit dropped the initialization
> of the trip_temp variable which results in the fan always spinning at
> full speed. Fix that.
> 
> While at it, drop the second (unnecessary/benign) call of get_tz_trend()
> to match rpi-6.5.y.
> 
> Fixes: f6264057efc8 ("drivers: thermal: step_wise: avoid throttling at hysteresis temperature after dropping below it")
> Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
> ---
>  drivers/thermal/gov_step_wise.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/thermal/gov_step_wise.c b/drivers/thermal/gov_step_wise.c
> index cf5c725660ce..eefeb6407d0f 100644
> --- a/drivers/thermal/gov_step_wise.c
> +++ b/drivers/thermal/gov_step_wise.c
> @@ -98,15 +98,13 @@ static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip_id
>  		trace_thermal_zone_trip(tz, trip_id, trip.type);
>  	}
>  
> -	hyst_temp = trip.temperature;
> +	hyst_temp = trip_temp = trip.temperature;
>  	if (tz->ops->get_trip_hyst) {
>  		tz->ops->get_trip_hyst(tz, trip_id, &hyst_temp);
>  		hyst_temp = trip_temp - hyst_temp;
>  	}
>  	trip_type = trip.type;
>  
> -	trend = get_tz_trend(tz, trip_id);
> -
>  	dev_dbg(&tz->device,
>  		"Trip%d[type=%d,temp=%d,hyst=%d]:trend=%d,throttle=%d\n",
>  		trip_id, trip_type, trip.temperature, hyst_temp, trend, throttle);
diff mbox series

Patch

diff --git a/drivers/thermal/gov_step_wise.c b/drivers/thermal/gov_step_wise.c
index cf5c725660ce..eefeb6407d0f 100644
--- a/drivers/thermal/gov_step_wise.c
+++ b/drivers/thermal/gov_step_wise.c
@@ -98,15 +98,13 @@  static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip_id
 		trace_thermal_zone_trip(tz, trip_id, trip.type);
 	}
 
-	hyst_temp = trip.temperature;
+	hyst_temp = trip_temp = trip.temperature;
 	if (tz->ops->get_trip_hyst) {
 		tz->ops->get_trip_hyst(tz, trip_id, &hyst_temp);
 		hyst_temp = trip_temp - hyst_temp;
 	}
 	trip_type = trip.type;
 
-	trend = get_tz_trend(tz, trip_id);
-
 	dev_dbg(&tz->device,
 		"Trip%d[type=%d,temp=%d,hyst=%d]:trend=%d,throttle=%d\n",
 		trip_id, trip_type, trip.temperature, hyst_temp, trend, throttle);