From: Rafael J. Wysocki Date: Tue, 19 Sep 2023 18:59:53 +0000 (+0200) Subject: thermal: trip: Drop redundant trips check from for_each_thermal_trip() X-Git-Tag: v6.6.17~501 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3a3bbc6911f57e1c3b4eabf1d098cde7bf7baeb0;p=platform%2Fkernel%2Flinux-rpi.git thermal: trip: Drop redundant trips check from for_each_thermal_trip() [ Upstream commit a15ffa783ea4210877886c59566a0d20f6b2bc09 ] 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. Signed-off-by: Rafael J. Wysocki Acked-by: Daniel Lezcano Stable-dep-of: e95fa7404716 ("thermal: gov_power_allocator: avoid inability to reset a cdev") Signed-off-by: Sasha Levin --- diff --git a/drivers/thermal/thermal_trip.c b/drivers/thermal/thermal_trip.c index 597ac41..4b3a9e7 100644 --- a/drivers/thermal/thermal_trip.c +++ b/drivers/thermal/thermal_trip.c @@ -17,9 +17,6 @@ int for_each_thermal_trip(struct thermal_zone_device *tz, 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)