thermal: core: Do not call handle_thermal_trip() if zone temperature is invalid
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 30 Apr 2024 15:45:55 +0000 (17:45 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 30 Apr 2024 19:16:13 +0000 (21:16 +0200)
Make __thermal_zone_device_update() bail out if update_temperature()
fails to update the zone temperature because __thermal_zone_get_temp()
has returned an error and the current zone temperature is
THERMAL_TEMP_INVALID (user space receiving netlink thermal messages,
thermal debug code and thermal governors may get confused otherwise).

Fixes: 9ad18043fb35 ("thermal: core: Send trip crossing notifications at init time if needed")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
Tested-by: Lukasz Luba <lukasz.luba@arm.com>
drivers/thermal/thermal_core.c

index f43237ef2cd0616709e4c2175d1161e6bcea780b..8bffd9101a32d9bc40899965c66dcf686afc713b 100644 (file)
@@ -487,6 +487,9 @@ void __thermal_zone_device_update(struct thermal_zone_device *tz,
 
        update_temperature(tz);
 
+       if (tz->temperature == THERMAL_TEMP_INVALID)
+               return;
+
        __thermal_zone_set_trips(tz);
 
        tz->notify_event = event;