Skip to contentSkip to conversation

thermal: core: Drop redundant trips check from for_each_thermal_trip()

PATCH In review Rafael J. Wysocki 2 participants 2 messages Sep 19, 2023 – Sep 26, 2023 Thermal

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 thermal: core: Drop redundant trips check from for_each_thermal_trip()

From: Rafael J. Wysocki <[email protected]>

It is invalid to call for_each_thermal_trip() on an unregistered thermal zone anyway, and as per thermal_zone_device_register_with_trips(), the trips[] table must be present if num_trips is greater than zero for the given thermal zone.

Hence, the trips check in for_each_thermal_trip() is redundant and so it can be dropped.

---
 drivers/thermal/thermal_trip.c |    3 ---
 1 file changed, 3 deletions(-)
drivers/thermal/thermal_trip.c +0 -3
Index: linux-pm/drivers/thermal/thermal_trip.c
===================================================================
@@ -17,9 +17,6 @@ int for_each_thermal_trip(struct thermal
 
 	lockdep_assert_held(&tz->lock);
 
-	if (!tz->trips)
-		return -ENODATA;
-
 	for (i = 0; i < tz->num_trips; i++) {
 		ret = cb(&tz->trips[i], data);
 		if (ret)
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Rafael J. Wysocki

From: Rafael J. Wysocki <[email protected]>

It is invalid to call for_each_thermal_trip() on an unregistered thermal zone anyway, and as per thermal_zone_device_register_with_trips(), the trips[] table must be present if num_trips is greater than zero for the given thermal zone.

Quoted 5 lines

Hence, the trips check in for_each_thermal_trip() is redundant and so it can be dropped.

---

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