From: Ai Chao Date: Thu, 16 Jan 2025 08:11:29 +0000 (+0800) Subject: platform/mellanox: mlxreg-io: use sysfs_emit() instead of sprintf() X-Git-Tag: v6.14-rc1~117^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ff44b1ca889f9ddc401daf375f8ee15a16f6d394;p=thirdparty%2Fkernel%2Flinux.git platform/mellanox: mlxreg-io: use sysfs_emit() instead of sprintf() Follow the advice in Documentation/filesystems/sysfs.rst: show() should only use sysfs_emit() or sysfs_emit_at() when formatting the value to be returned to user space. Signed-off-by: Ai Chao Acked-by: Vadim Pasternak Link: https://lore.kernel.org/r/20250116081129.2902274-1-aichao@kylinos.cn Reviewed-by: Ilpo Järvinen Signed-off-by: Ilpo Järvinen --- diff --git a/drivers/platform/mellanox/mlxreg-io.c b/drivers/platform/mellanox/mlxreg-io.c index 595276206baf1..97fefe6c38d1d 100644 --- a/drivers/platform/mellanox/mlxreg-io.c +++ b/drivers/platform/mellanox/mlxreg-io.c @@ -126,7 +126,7 @@ mlxreg_io_attr_show(struct device *dev, struct device_attribute *attr, mutex_unlock(&priv->io_lock); - return sprintf(buf, "%u\n", regval); + return sysfs_emit(buf, "%u\n", regval); access_error: mutex_unlock(&priv->io_lock);