Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <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>

authored by

Ai Chao and committed by
Ilpo Järvinen
ff44b1ca fcf1b6f8

+1 -1
+1 -1
drivers/platform/mellanox/mlxreg-io.c
··· 126 126 127 127 mutex_unlock(&priv->io_lock); 128 128 129 - return sprintf(buf, "%u\n", regval); 129 + return sysfs_emit(buf, "%u\n", regval); 130 130 131 131 access_error: 132 132 mutex_unlock(&priv->io_lock);