summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOvidiu Panait <ovidiu.panait.oss@gmail.com>2026-06-07 00:04:20 +0300
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2026-06-08 16:57:05 +0300
commit64762d48ec84d36fc2618920a731368387253efc (patch)
tree1b16eea26d56ba1624034c278d80bcf246552e05
parente4f87cfcbae03498f0fd1689653cf84126196e14 (diff)
downloadlinux-64762d48ec84d36fc2618920a731368387253efc.tar.xz
thermal: sysfs: Replace sscanf() with kstrtoul()
Replace sscanf() with kstrtoul() in cur_state_store(), as kstrto<type> is preferred over single-variable sscanf(). Signed-off-by: Ovidiu Panait <ovidiu.panait.oss@gmail.com> [ rjw: Changelog edits ] Link: https://patch.msgid.link/20260606210420.2311145-3-ovidiu.panait.oss@gmail.com Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/thermal/thermal_sysfs.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/thermal/thermal_sysfs.c b/drivers/thermal/thermal_sysfs.c
index 9f2f25a6da37..b44abfc997ed 100644
--- a/drivers/thermal/thermal_sysfs.c
+++ b/drivers/thermal/thermal_sysfs.c
@@ -536,11 +536,9 @@ cur_state_store(struct device *dev, struct device_attribute *attr,
unsigned long state;
int result;
- if (sscanf(buf, "%ld\n", &state) != 1)
- return -EINVAL;
-
- if ((long)state < 0)
- return -EINVAL;
+ result = kstrtoul(buf, 10, &state);
+ if (result < 0)
+ return result;
/* Requested state should be less than max_state + 1 */
if (state > cdev->max_state)