[PATCH] bus: fsl-mc: Replace snprintf with sysfs_emit in sysfs show functions
Christophe Leroy
christophe.leroy at csgroup.eu
Fri Aug 22 22:29:11 AEST 2025
Le 22/08/2025 à 13:57, Chelsy Ratnawat a écrit :
> Use sysfs_emit() instead of snprintf() when writing to sysfs buffers,
> as recommended by the kernel documentation.
Change modalias_show() at the same time.
Christophe
>
> Signed-off-by: Chelsy Ratnawat <chelsyratnawat2001 at gmail.com>
> ---
> drivers/bus/fsl-mc/fsl-mc-bus.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/bus/fsl-mc/fsl-mc-bus.c b/drivers/bus/fsl-mc/fsl-mc-bus.c
> index c1c0a4759c7e..13172a0cdb48 100644
> --- a/drivers/bus/fsl-mc/fsl-mc-bus.c
> +++ b/drivers/bus/fsl-mc/fsl-mc-bus.c
> @@ -203,7 +203,7 @@ static ssize_t driver_override_show(struct device *dev,
> {
> struct fsl_mc_device *mc_dev = to_fsl_mc_device(dev);
>
> - return snprintf(buf, PAGE_SIZE, "%s\n", mc_dev->driver_override);
> + return sysfs_emit(buf, "%s\n", mc_dev->driver_override);
> }
> static DEVICE_ATTR_RW(driver_override);
>
> --
> 2.47.3
>
>
More information about the Linuxppc-dev
mailing list