diff mbox series

scsi: mpi3mr: Replace snprintf with sysfs_emit in adp_state_show

Message ID 20220505061742.1657020-1-wanjiabing@vivo.com (mailing list archive)
State New, archived
Headers show
Series scsi: mpi3mr: Replace snprintf with sysfs_emit in adp_state_show | expand

Commit Message

Jiabing Wan May 5, 2022, 6:17 a.m. UTC
Fix following coccicheck warning:
./drivers/scsi/mpi3mr/mpi3mr_app.c:1588:8-16: WARNING: use scnprintf or sprintf

Use sysfs_emit instead of snprintf and fix some comments.

Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
---
 drivers/scsi/mpi3mr/mpi3mr_app.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/drivers/scsi/mpi3mr/mpi3mr_app.c b/drivers/scsi/mpi3mr/mpi3mr_app.c
index 73bb7992d5a8..86a7206548e4 100644
--- a/drivers/scsi/mpi3mr/mpi3mr_app.c
+++ b/drivers/scsi/mpi3mr/mpi3mr_app.c
@@ -1559,12 +1559,12 @@  void mpi3mr_bsg_init(struct mpi3mr_ioc *mrioc)
 }
 
 /**
- * adapter_state_show - SysFS callback for adapter state show
+ * adp_state_show - SysFS callback for adapter state show
  * @dev: class device
  * @attr: Device attributes
  * @buf: Buffer to copy
  *
- * Return: snprintf() return after copying adapter state
+ * Return: sysfs_emit() return after copying adapter state
  */
 static ssize_t
 adp_state_show(struct device *dev, struct device_attribute *attr,
@@ -1585,7 +1585,7 @@  adp_state_show(struct device *dev, struct device_attribute *attr,
 	else
 		adp_state = MPI3MR_BSG_ADPSTATE_OPERATIONAL;
 
-	return snprintf(buf, PAGE_SIZE, "%u\n", adp_state);
+	return sysfs_emit(buf, "%u\n", adp_state);
 }
 
 static DEVICE_ATTR_RO(adp_state);