Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dc2689a9 authored by Ram Chandrasekar's avatar Ram Chandrasekar Committed by Gerrit - the friendly Code Review server
Browse files

drivers: thermal: Avoid trip evaluation for disabled thermal zone



Avoid trip evaluation for disabled thermal zone, as the temperature
reading will be invalid and using the same to evaluate the trips will
lead to undefined behavior.

Change-Id: I5ea744d36875a425b0c3ed07c3ab45c94f9b59ca
Signed-off-by: default avatarRam Chandrasekar <rkumbako@codeaurora.org>
parent 4201edd7
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -217,13 +217,15 @@ static int of_thermal_set_trips(struct thermal_zone_device *tz,
		return -EINVAL;

	mutex_lock(&data->senps->lock);
	if (data->mode == THERMAL_DEVICE_DISABLED)
		goto set_trips_exit;
	of_thermal_aggregate_trip_types(tz, GENMASK(THERMAL_TRIP_CRITICAL, 0),
					&low, &high);
	data->senps->trip_low = low;
	data->senps->trip_high = high;
	ret = data->senps->ops->set_trips(data->senps->sensor_data,
					  low, high);

set_trips_exit:
	mutex_unlock(&data->senps->lock);
	return ret;
}