thermal: trip: Drop redundant trips check from for_each_thermal_trip()
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 19 Sep 2023 18:59:53 +0000 (20:59 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 26 Sep 2023 15:59:53 +0000 (17:59 +0200)
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 <rafael.j.wysocki@intel.com>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
drivers/thermal/thermal_trip.c

index 024e2e365a26b60d8ef73c3bffa2053e90f818fb..1cadb3b5d10487766cd05ab8c1b54e56a28b50e2 100644 (file)
@@ -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)