]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
bus: fsl-mc: Replace snprintf and sprintf with sysfs_emit in sysfs show functions
authorChelsy Ratnawat <chelsyratnawat2001@gmail.com>
Fri, 22 Aug 2025 12:43:39 +0000 (05:43 -0700)
committerChristophe Leroy <christophe.leroy@csgroup.eu>
Mon, 25 Aug 2025 17:55:03 +0000 (19:55 +0200)
Use sysfs_emit() instead of snprintf()/sprintf()  when writing
to sysfs buffers, as recommended by the kernel documentation.

Signed-off-by: Chelsy Ratnawat <chelsyratnawat2001@gmail.com>
Acked-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Link: https://lore.kernel.org/r/20250822124339.1739290-1-chelsyratnawat2001@gmail.com
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
drivers/bus/fsl-mc/fsl-mc-bus.c

index 5027da143728eb5bb3b42ca4d49cde69ec1b8a0a..25845c04e5620aff54a33c26a08170f6f3a88720 100644 (file)
@@ -176,8 +176,8 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
 {
        struct fsl_mc_device *mc_dev = to_fsl_mc_device(dev);
 
-       return sprintf(buf, "fsl-mc:v%08Xd%s\n", mc_dev->obj_desc.vendor,
-                      mc_dev->obj_desc.type);
+       return sysfs_emit(buf, "fsl-mc:v%08Xd%s\n", mc_dev->obj_desc.vendor,
+                       mc_dev->obj_desc.type);
 }
 static DEVICE_ATTR_RO(modalias);
 
@@ -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);