scsi: ibmvscsi_tgt: convert sysfs snprintf to sysfs_emit

Message ID 483482fb.1d3.184b91dde72.Coremail.wangkailong@jari.cn
State New
Headers
Series scsi: ibmvscsi_tgt: convert sysfs snprintf to sysfs_emit |

Commit Message

KaiLong Wang Nov. 27, 2022, 12:44 p.m. UTC
  Fix the following coccicheck warning:

drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c:3625:8-16: WARNING: use
scnprintf or sprintf
drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c:3619:8-16: WARNING: use
scnprintf or sprintf
drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c:3633:8-16: WARNING: use
scnprintf or sprintf

Signed-off-by: KaiLong Wang <wangkailong@jari.cn>
---
 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
  

Comments

Chaitanya Kulkarni Nov. 28, 2022, 7:30 p.m. UTC | #1
On 11/27/22 04:44, KaiLong Wang wrote:
> Fix the following coccicheck warning:
> 
> drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c:3625:8-16: WARNING: use
> scnprintf or sprintf
> drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c:3619:8-16: WARNING: use
> scnprintf or sprintf
> drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c:3633:8-16: WARNING: use
> scnprintf or sprintf
> 
> Signed-off-by: KaiLong Wang <wangkailong@jari.cn>


Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck
  

Patch

diff --git a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
index e8770310a64b..d9a615306949 100644
--- a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
+++ b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
@@ -3616,13 +3616,13 @@  static void ibmvscsis_remove(struct vio_dev *vdev)
 static ssize_t system_id_show(struct device *dev,
 			      struct device_attribute *attr, char *buf)
 {
-	return snprintf(buf, PAGE_SIZE, "%s\n", system_id);
+	return sysfs_emit(buf, "%s\n", system_id);
 }
 
 static ssize_t partition_number_show(struct device *dev,
 				     struct device_attribute *attr, char *buf)
 {
-	return snprintf(buf, PAGE_SIZE, "%x\n", partition_number);
+	return sysfs_emit(buf, "%x\n", partition_number);
 }
 
 static ssize_t unit_address_show(struct device *dev,
@@ -3630,7 +3630,7 @@  static ssize_t unit_address_show(struct device *dev,
 {
 	struct scsi_info *vscsi = container_of(dev, struct scsi_info, dev);
 
-	return snprintf(buf, PAGE_SIZE, "%x\n", vscsi->dma_dev->unit_address);
+	return sysfs_emit(buf, "%x\n", vscsi->dma_dev->unit_address);
 }
 
 static int ibmvscsis_get_system_info(void)