]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
platform/mellanox: mlxreg-hotplug: use sysfs_emit() instead of sprintf()
authorAi Chao <aichao@kylinos.cn>
Thu, 16 Jan 2025 08:10:00 +0000 (16:10 +0800)
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Mon, 20 Jan 2025 12:13:20 +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/20250116081000.2900435-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-hotplug.c

index 6aa2a465036707032af269cde85f09846b8c7555..b347000e4329f2093638373be235514dccb358cc 100644 (file)
@@ -232,7 +232,7 @@ static ssize_t mlxreg_hotplug_attr_show(struct device *dev,
                        regval = !!(regval & data->mask);
        }
 
-       return sprintf(buf, "%u\n", regval);
+       return sysfs_emit(buf, "%u\n", regval);
 }
 
 #define PRIV_ATTR(i) priv->mlxreg_hotplug_attr[i]