]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
hwmon: (emc1403) Replace sprintf() with sysfs_emit()
authorAmay Agarwal <tt@turingtested.xyz>
Tue, 3 Mar 2026 15:24:56 +0000 (20:54 +0530)
committerGuenter Roeck <linux@roeck-us.net>
Tue, 31 Mar 2026 02:45:05 +0000 (19:45 -0700)
Replace sprintf() with sysfs_emit() when writing to sysfs buffers.

sysfs_emit() performs proper bounds checking and is the preferred
helper for sysfs output.

No functional change intended.

Signed-off-by: Amay Agarwal <tt@turingtested.xyz>
Link: https://lore.kernel.org/r/20260303152456.35763-6-tt@turingtested.xyz
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/emc1403.c

index ccce948a4306e6b8b76ffacf0302959b5a93f2a4..964a8cb278f16a4b4966d31bb0a68ff4858d092b 100644 (file)
@@ -40,7 +40,7 @@ static ssize_t power_state_show(struct device *dev, struct device_attribute *att
        retval = regmap_read(data->regmap, 0x03, &val);
        if (retval < 0)
                return retval;
-       return sprintf(buf, "%d\n", !!(val & BIT(6)));
+       return sysfs_emit(buf, "%d\n", !!(val & BIT(6)));
 }
 
 static ssize_t power_state_store(struct device *dev, struct device_attribute *attr,