Re: [PATCH v2 3/5] hwmon: (ads7828) Replace sprintf() with sysfs_emit()
From: Guenter Roeck
Date: Tue Mar 03 2026 - 12:05:29 EST
On Tue, Mar 03, 2026 at 08:54:54PM +0530, Amay Agarwal wrote:
> 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@xxxxxxxxxxxxxxxx>
Watch out for multip-line alignment issues in the future.
No need to resend, I'll fix that.
Applied.
Thanks,
Guenter
> ---
> drivers/hwmon/ads7828.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/hwmon/ads7828.c b/drivers/hwmon/ads7828.c
> index 436637264056..a09de9d016ac 100644
> --- a/drivers/hwmon/ads7828.c
> +++ b/drivers/hwmon/ads7828.c
> @@ -62,7 +62,7 @@ static ssize_t ads7828_in_show(struct device *dev,
> if (err < 0)
> return err;
>
> - return sprintf(buf, "%d\n",
> + return sysfs_emit(buf, "%d\n",
> DIV_ROUND_CLOSEST(regval * data->lsb_resol, 1000));
> }
>