summaryrefslogtreecommitdiff
path: root/drivers/thermal/thermal_hwmon.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2024-10-11 00:05:25 +0200
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2024-10-23 11:56:19 +0200
commitcba00d16a2b0b0cfc8266124266ed23ab9eae918 (patch)
tree7e6252c801a6599c4f92b4b4775015d5e3e72ef4 /drivers/thermal/thermal_hwmon.c
parent17f76be51c52338d9632070cce2b181a7517f03d (diff)
thermal: core: Add and use thermal zone guard
Add and use a guard for thermal zone locking. This allows quite a few error code paths to be simplified among other things and brings in a noticeable code size reduction for a good measure. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Link: https://patch.msgid.link/1930069.tdWV9SEqCh@rjwysocki.net Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
Diffstat (limited to 'drivers/thermal/thermal_hwmon.c')
-rw-r--r--drivers/thermal/thermal_hwmon.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/thermal/thermal_hwmon.c b/drivers/thermal/thermal_hwmon.c
index f0e504fd866a..37da7a8ea948 100644
--- a/drivers/thermal/thermal_hwmon.c
+++ b/drivers/thermal/thermal_hwmon.c
@@ -78,12 +78,9 @@ temp_crit_show(struct device *dev, struct device_attribute *attr, char *buf)
int temperature;
int ret;
- mutex_lock(&tz->lock);
+ guard(thermal_zone)(tz);
ret = tz->ops.get_crit_temp(tz, &temperature);
-
- mutex_unlock(&tz->lock);
-
if (ret)
return ret;