linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH linux-next] scsi:snic_attrs:Convert sysfs sprintf/snprintf family to sysfs_emit
@ 2021-08-21  3:55 CGEL
  0 siblings, 0 replies; only message in thread
From: CGEL @ 2021-08-21  3:55 UTC (permalink / raw)
  To: Karan Tilak Kumar
  Cc: Sesidhar Baddela, James E . J . Bottomley, Martin K . Petersen,
	linux-scsi, linux-kernel, jing yangyang, Zeal Robot

From: jing yangyang <jing.yangyang@zte.com.cn>

Fix the following coccicheck warning:
./drivers/scsi/snic/snic_attrs.c:49: 8-16: WARNING:  use scnprintf or sprintf
./drivers/scsi/snic/snic_attrs.c:62: 8-16: WARNING:  use scnprintf or sprintf
./drivers/scsi/snic/snic_attrs.c:40: 8-16: WARNING:  use scnprintf or sprintf
./drivers/scsi/snic/snic_attrs.c:30: 8-16: WARNING:  use scnprintf or sprintf

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: jing yangyang <jing.yangyang@zte.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 32d5d55..0d41a00 100644
--- a/drivers/scsi/snic/snic_attrs.c
+++ b/drivers/scsi/snic/snic_attrs.c
@@ -27,7 +27,7 @@
 {
 	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 @@
 {
 	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 @@
 		      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 @@
 	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");
 }
 
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-08-21  3:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-21  3:55 [PATCH linux-next] scsi:snic_attrs:Convert sysfs sprintf/snprintf family to sysfs_emit CGEL

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).