[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211105081454.76950-1-yao.jing2@zte.com.cn>
Date: Fri, 5 Nov 2021 08:14:54 +0000
From: cgel.zte@...il.com
To: kartilak@...co.com
Cc: sebaddel@...co.com, jejb@...ux.ibm.com, martin.petersen@...cle.com,
linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org,
Jing Yao <yao.jing2@....com.cn>, Zeal Robot <zealci@....com.cn>
Subject: [PATCH] scsi: snic: Replace snprintf in show functions with sysfs_emit
From: Jing Yao <yao.jing2@....com.cn>
coccicheck complains about the use of snprintf() in sysfs show
functions:
WARNING use scnprintf or sprintf
Use sysfs_emit instead of scnprintf, snprintf or sprintf makes more
sense.
Reported-by: Zeal Robot <zealci@....com.cn>
Signed-off-by: Jing Yao <yao.jing2@....com.cn>
---
drivers/scsi/snic/snic_attrs.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/scsi/snic/snic_attrs.c b/drivers/scsi/snic/snic_attrs.c
index dc03ce1ec909..cb501be3e9ec 100644
--- a/drivers/scsi/snic/snic_attrs.c
+++ b/drivers/scsi/snic/snic_attrs.c
@@ -27,7 +27,7 @@ snic_show_sym_name(struct device *dev,
{
struct snic *snic = shost_priv(class_to_shost(dev));
- return snprintf(buf, PAGE_SIZE, "%s\n", snic->name);
+ return sysfs_emit(buf, "%s\n", snic->name);
}
static ssize_t
@@ -37,7 +37,7 @@ snic_show_state(struct device *dev,
{
struct snic *snic = shost_priv(class_to_shost(dev));
- return snprintf(buf, PAGE_SIZE, "%s\n",
+ return sysfs_emit(buf, "%s\n",
snic_state_str[snic_get_state(snic)]);
}
@@ -46,7 +46,7 @@ snic_show_drv_version(struct device *dev,
struct device_attribute *attr,
char *buf)
{
- return snprintf(buf, PAGE_SIZE, "%s\n", SNIC_DRV_VERSION);
+ return sysfs_emit(buf, "%s\n", SNIC_DRV_VERSION);
}
static ssize_t
@@ -59,7 +59,7 @@ snic_show_link_state(struct device *dev,
if (snic->config.xpt_type == SNIC_DAS)
snic->link_status = svnic_dev_link_status(snic->vdev);
- return snprintf(buf, PAGE_SIZE, "%s\n",
+ return sysfs_emit(buf, "%s\n",
(snic->link_status) ? "Link Up" : "Link Down");
}
--
2.25.1
Powered by blists - more mailing lists