diff mbox series

scsi: convert sysfs snprintf to sysfs_emit

Message ID 30394ceb9ab9d12b14919234f8bbe67f@208suo.com
State New
Headers show
Series scsi: convert sysfs snprintf to sysfs_emit | expand

Commit Message

hanyu001@208suo.com July 13, 2023, 7:24 a.m. UTC
Fix the following coccincheck warning:
drivers/usb/misc/usbsevseg.c:170:8-16:
WARNING: use scnprintf or sprintf

WARNING: use scnprintf or sprintf
WARNING: use scnprintf or sprintf

Signed-off-by: ztt <1549089851@qq.com>
---
  drivers/scsi/hptiop.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

  static ssize_t hptiop_show_fw_version(struct device *dev,
@@ -1120,7 +1120,7 @@ static ssize_t hptiop_show_fw_version(struct 
device *dev,
      struct Scsi_Host *host = class_to_shost(dev);
      struct hptiop_hba *hba = (struct hptiop_hba *)host->hostdata;

-    return snprintf(buf, PAGE_SIZE, "%d.%d.%d.%d\n",
+    return scnprintf(buf, PAGE_SIZE, "%d.%d.%d.%d\n",
                  hba->firmware_version >> 24,
                  (hba->firmware_version >> 16) & 0xff,
                  (hba->firmware_version >> 8) & 0xff,
diff mbox series

Patch

diff --git a/drivers/scsi/hptiop.c b/drivers/scsi/hptiop.c
index f5334ccbf2ca..26282aceac75 100644
--- a/drivers/scsi/hptiop.c
+++ b/drivers/scsi/hptiop.c
@@ -1111,7 +1111,7 @@  static int hptiop_adjust_disk_queue_depth(struct 
scsi_device *sdev,
  static ssize_t hptiop_show_version(struct device *dev,
                     struct device_attribute *attr, char *buf)
  {
-    return snprintf(buf, PAGE_SIZE, "%s\n", driver_ver);
+    return scnprintf(buf, PAGE_SIZE, "%s\n", driver_ver);
  }