]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
platform/mellanox: mlxreg-io: use sysfs_emit() instead of sprintf()
authorAi Chao <aichao@kylinos.cn>
Thu, 16 Jan 2025 08:11:29 +0000 (16:11 +0800)
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Mon, 20 Jan 2025 12:13:22 +0000 (14:13 +0200)
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 <aichao@kylinos.cn>
Acked-by: Vadim Pasternak <vadimp@nvidia.com>
Link: https://lore.kernel.org/r/20250116081129.2902274-1-aichao@kylinos.cn
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
drivers/platform/mellanox/mlxreg-io.c

index 595276206baf121c3cf0fff994490def408fe26a..97fefe6c38d1d39715b0fc7279024ae55986ba86 100644 (file)
@@ -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);