diff mbox series

scsi: fnic: convert sysfs snprintf to sysfs_emit

Message ID 20220616113922.8106-1-zhangxuezhi1@coolpad.com
State New
Headers show
Series scsi: fnic: convert sysfs snprintf to sysfs_emit | expand

Commit Message

Xuezhi Zhang June 16, 2022, 11:39 a.m. UTC
Fix the following coccicheck warnings:

drivers/scsi/fnic/fnic_attrs.c:35:8-16:
WARNING: use scnprintf or sprintf
drivers/scsi/fnic/fnic_attrs.c:43:8-16:
WARNING: use scnprintf or sprintf
drivers/scsi/fnic/fnic_attrs.c:29:8-16:
WARNING: use scnprintf or sprintf

Signed-off-by: Xuezhi Zhang <zhangxuezhi1@coolpad.com>
---
 drivers/scsi/fnic/fnic_attrs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/drivers/scsi/fnic/fnic_attrs.c b/drivers/scsi/fnic/fnic_attrs.c
index bbe2ca4971b2..d02555bf3df1 100644
--- a/drivers/scsi/fnic/fnic_attrs.c
+++ b/drivers/scsi/fnic/fnic_attrs.c
@@ -26,13 +26,13 @@  static ssize_t fnic_show_state(struct device *dev,
 	struct fc_lport *lp = shost_priv(class_to_shost(dev));
 	struct fnic *fnic = lport_priv(lp);
 
-	return snprintf(buf, PAGE_SIZE, "%s\n", fnic_state_str[fnic->state]);
+	return sysfs_emit(buf, "%s\n", fnic_state_str[fnic->state]);
 }
 
 static ssize_t fnic_show_drv_version(struct device *dev,
 				     struct device_attribute *attr, char *buf)
 {
-	return snprintf(buf, PAGE_SIZE, "%s\n", DRV_VERSION);
+	return sysfs_emit(buf, "%s\n", DRV_VERSION);
 }
 
 static ssize_t fnic_show_link_state(struct device *dev,
@@ -40,7 +40,7 @@  static ssize_t fnic_show_link_state(struct device *dev,
 {
 	struct fc_lport *lp = shost_priv(class_to_shost(dev));
 
-	return snprintf(buf, PAGE_SIZE, "%s\n", (lp->link_up)
+	return sysfs_emit(buf, "%s\n", (lp->link_up)
 			? "Link Up" : "Link Down");
 }