Skip to content

Commit ea31056

Browse files
committed
thermal: sysfs: Fix trip_point_hyst_store()
After commit 2e38a2a ("thermal/core: Add a generic thermal_zone_set_trip() function") updating a trip point temperature doesn't actually work, because the value supplied by user space is subsequently overwritten with the current trip point hysteresis value. Fix this by changing the code to parse the number string supplied by user space after retrieving the current trip point data from the thermal zone. Also drop a redundant tab character from the code in question. Fixes: 2e38a2a ("thermal/core: Add a generic thermal_zone_set_trip() function") Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Cc: 6.3+ <stable@vger.kernel.org> # 6.3+
1 parent ce9ecca commit ea31056

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

drivers/thermal/thermal_sysfs.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,6 @@ trip_point_hyst_store(struct device *dev, struct device_attribute *attr,
185185
if (sscanf(attr->attr.name, "trip_point_%d_hyst", &trip_id) != 1)
186186
return -EINVAL;
187187

188-
if (kstrtoint(buf, 10, &trip.hysteresis))
189-
return -EINVAL;
190-
191188
mutex_lock(&tz->lock);
192189

193190
if (!device_is_registered(dev)) {
@@ -198,7 +195,11 @@ trip_point_hyst_store(struct device *dev, struct device_attribute *attr,
198195
ret = __thermal_zone_get_trip(tz, trip_id, &trip);
199196
if (ret)
200197
goto unlock;
201-
198+
199+
ret = kstrtoint(buf, 10, &trip.hysteresis);
200+
if (ret)
201+
goto unlock;
202+
202203
ret = thermal_zone_set_trip(tz, trip_id, &trip);
203204
unlock:
204205
mutex_unlock(&tz->lock);

0 commit comments

Comments
 (0)