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

Juerg Haefliger juerg.haefliger at canonical.com
Fri Nov 17 13:50:18 UTC 2023


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 at 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);
-- 
2.40.1




More information about the kernel-team mailing list