diff mbox series

scsi: sysfs: replace scnprintf() with sysfs_emit() in sdev_show_blacklist()

Message ID 20250620105344.455283-1-shankari.ak0208@gmail.com
State New
Headers show
Series scsi: sysfs: replace scnprintf() with sysfs_emit() in sdev_show_blacklist() | expand

Commit Message

Shankari Anand June 20, 2025, 10:53 a.m. UTC
Documentation/filesystems/sysfs.rst mentions that show() should only
use sysfs_emit() or sysfs_emit_at() when formating the value to be
returned to user space. So replace scnprintf() with sysfs_emit().

Signed-off-by: Shankari Anand <shankari.ak0208@gmail.com>
---
 drivers/scsi/scsi_sysfs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index d772258e29ad..074b02e4cf9e 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -1095,14 +1095,14 @@  sdev_show_blacklist(struct device *dev, struct device_attribute *attr,
 			name = sdev_bflags_name[i];
 
 		if (name)
-			len += scnprintf(buf + len, PAGE_SIZE - len,
+			len += sysfs_emit(buf + len,
 					 "%s%s", len ? " " : "", name);
 		else
-			len += scnprintf(buf + len, PAGE_SIZE - len,
+			len += sysfs_emit(buf + len,
 					 "%sINVALID_BIT(%d)", len ? " " : "", i);
 	}
 	if (len)
-		len += scnprintf(buf + len, PAGE_SIZE - len, "\n");
+		len += sysfs_emit(buf + len, "\n");
 	return len;
 }
 static DEVICE_ATTR(blacklist, S_IRUGO, sdev_show_blacklist, NULL);