Re: [PATCH] misc: ad525x_dpot: Replace sprintf with sysfs_emit in sysfs_show_reg
From: Greg Kroah-Hartman
Date: Mon Nov 03 2025 - 07:50:09 EST
On Mon, Nov 03, 2025 at 01:34:03PM +0100, Thorsten Blum wrote:
> Replace sprintf() with sysfs_emit() in sysfs_show_reg(). sysfs_emit() is
> preferred for formatting sysfs output as it provides better bounds
> checking. No functional changes.
>
> Signed-off-by: Thorsten Blum <thorsten.blum@xxxxxxxxx>
> Suggested-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> ---
> drivers/misc/ad525x_dpot.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/misc/ad525x_dpot.c b/drivers/misc/ad525x_dpot.c
> index 04683b981e54..519f97089a00 100644
> --- a/drivers/misc/ad525x_dpot.c
> +++ b/drivers/misc/ad525x_dpot.c
> @@ -419,7 +419,7 @@ static ssize_t sysfs_show_reg(struct device *dev,
> s32 value;
>
> if (reg & DPOT_ADDR_OTP_EN)
> - return sprintf(buf, "%s\n", str_enabled_disabled(
> + return sysfs_emit(buf, "%s\n", str_enabled_disabled(
> test_bit(DPOT_RDAC_MASK & reg, data->otp_en_mask)));
I did not suggest doing this for existing code at all, it's only needed
for new code, I've said so many times.
sprintf() works just fine here, there's no bug or issue with it.
thanks,
greg k-h