]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
hwmon: (ads7828) Replace sprintf() with sysfs_emit()
authorAmay Agarwal <tt@turingtested.xyz>
Tue, 3 Mar 2026 15:24:54 +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-4-tt@turingtested.xyz
[groeck: Fixed continuation line alignment]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/ads7828.c

index 436637264056cda3f997e304a953d289bf2be2f3..7f43565ca284160c2b70f7475a8e60babc620b9f 100644 (file)
@@ -62,8 +62,8 @@ static ssize_t ads7828_in_show(struct device *dev,
        if (err < 0)
                return err;
 
-       return sprintf(buf, "%d\n",
-                      DIV_ROUND_CLOSEST(regval * data->lsb_resol, 1000));
+       return sysfs_emit(buf, "%d\n",
+                         DIV_ROUND_CLOSEST(regval * data->lsb_resol, 1000));
 }
 
 static SENSOR_DEVICE_ATTR_RO(in0_input, ads7828_in, 0);