scsi: be2iscsi: wacom: convert sysfs sprintf/snprintf family to sysfs_emit
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 scsi: be2iscsi: wacom: convert sysfs sprintf/snprintf family to sysfs_emit
Fix the following coccicheck warning:
./drivers/hid/wacom_sys.c:1828:8-16: WARNING: use scnprintf or sprintf.
./drivers/scsi/be2iscsi/be_mgmt.c:1251:9-17: WARNING: use scnprintf or sprintf ./drivers/scsi/be2iscsi/be_mgmt.c:1145:8-16: WARNING: use scnprintf or sprintf ./drivers/scsi/be2iscsi/be_mgmt.c:1164:8-16: WARNING: use scnprintf or sprintf ./drivers/scsi/be2iscsi/be_mgmt.c:1280:8-16: WARNING: use scnprintf or sprintf
--- drivers/scsi/be2iscsi/be_mgmt.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/be2iscsi/be_mgmt.c +0 -0
@@ -1142,7 +1142,7 @@ ssize_t beiscsi_drvr_ver_disp(struct device *dev, struct device_attribute
*attr,
char *buf)
{
- return snprintf(buf, PAGE_SIZE, BE_NAME "\n");
+ return scnprintf(buf, PAGE_SIZE, BE_NAME "\n");
}
/**
@@ -1161,7 +1161,7 @@ beiscsi_fw_ver_disp(struct device *dev, struct device_attribute *attr,
struct Scsi_Host *shost = class_to_shost(dev);
struct beiscsi_hba *phba = iscsi_host_priv(shost);- return snprintf(buf, PAGE_SIZE, "%s\n", phba->fw_ver_str);
+ return scnprintf(buf, PAGE_SIZE, "%s\n", phba->fw_ver_str);
}
/**
@@ -1248,7 +1248,7 @@ beiscsi_adap_family_disp(struct device *dev, struct device_attribute *attr,
case BE_DEVICE_ID1:
case OC_DEVICE_ID1:
case OC_DEVICE_ID2:
- return snprintf(buf, PAGE_SIZE,
+ return scnprintf(buf, PAGE_SIZE,
"Obsolete/Unsupported BE2 Adapter Family\n");
case BE_DEVICE_ID2:
case OC_DEVICE_ID3:
@@ -1277,7 +1277,7 @@ beiscsi_phys_port_disp(struct device *dev, struct device_attribute *attr,
struct Scsi_Host *shost = class_to_shost(dev);
struct beiscsi_hba *phba = iscsi_host_priv(shost);- return snprintf(buf, PAGE_SIZE, "Port Identifier : %u\n",
+ return scnprintf(buf, PAGE_SIZE, "Port Identifier : %u\n",
phba->fw_config.phys_port);
}
Quoted 13 lines · On Fri, Jul 14, 2023 at 04:10:43PM +0800, [email protected] wrote:
Fix the following coccicheck warning:
./drivers/hid/wacom_sys.c:1828:8-16: WARNING: use scnprintf or sprintf.
./drivers/scsi/be2iscsi/be_mgmt.c:1251:9-17: WARNING: use scnprintf or sprintf
./drivers/scsi/be2iscsi/be_mgmt.c:1145:8-16: WARNING: use scnprintf or sprintf
./drivers/scsi/be2iscsi/be_mgmt.c:1164:8-16: WARNING: use scnprintf or sprintf
./drivers/scsi/be2iscsi/be_mgmt.c:1280:8-16: WARNING: use scnprintf or sprintf
Quoted 4 lines
Signed-off-by ztt <[email protected]>--- drivers/scsi/be2iscsi/be_mgmt.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
The changes here to scnprintf don't match the subject, which mentions sysfs_emit. It would be better to convert to sysfs_emit.
- Chris Leech
Quoted 44 lines
drivers/scsi/be2iscsi/be_mgmt.c +2
-2@@ -1142,7 +1142,7 @@ ssize_t beiscsi_drvr_ver_disp(struct device *dev, struct device_attribute *attr, char *buf) { - return snprintf(buf, PAGE_SIZE, BE_NAME "\n"); + return scnprintf(buf, PAGE_SIZE, BE_NAME "\n"); }/** @@ -1161,7 +1161,7 @@ beiscsi_fw_ver_disp(struct device *dev, structdevice_attribute *attr, struct Scsi_Host *shost = class_to_shost(dev);struct beiscsi_hba *phba =iscsi_host_priv (shost); -return snprintf (buf,PAGE_SIZE ,"%s\n" , phba->fw_ver_str); +return scnprintf (buf,PAGE_SIZE ,"%s\n" , phba->fw_ver_str); }/**
drivers/scsi/be2iscsi/be_mgmt.c +1
-1@@ -1248,7 +1248,7 @@ beiscsi_adap_family_disp(struct device *dev, struct device_attribute *attr, case BE_DEVICE_ID1:case OC_DEVICE_ID1 :case OC_DEVICE_ID2 : -return snprintf (buf,PAGE_SIZE , +return scnprintf (buf,PAGE_SIZE ,"Obsolete/Unsupported BE2 Adapter Family\n" );case BE_DEVICE_ID2 :case
OC_DEVICE_ID3:drivers/scsi/be2iscsi/be_mgmt.c +1
-1@@ -1277,7 +1277,7 @@ beiscsi_phys_port_disp(struct device *dev, structdevice_attribute *attr, struct Scsi_Host *shost = class_to_shost(dev);struct beiscsi_hba *phba =iscsi_host_priv (shost); -return snprintf (buf,PAGE_SIZE ,"Port Identifier : %u\n" , +return scnprintf (buf,PAGE_SIZE ,"Port Identifier : %u\n" , phba->fw_config.phys_port); }
Quoted 13 lines · On Fri, Jul 14, 2023 at 04:10:43PM +0800, [email protected] wrote:
Fix the following coccicheck warning:
./drivers/hid/wacom_sys.c:1828:8-16: WARNING: use scnprintf or sprintf.
./drivers/scsi/be2iscsi/be_mgmt.c:1251:9-17: WARNING: use scnprintf or sprintf
./drivers/scsi/be2iscsi/be_mgmt.c:1145:8-16: WARNING: use scnprintf or sprintf
./drivers/scsi/be2iscsi/be_mgmt.c:1164:8-16: WARNING: use scnprintf or sprintf
./drivers/scsi/be2iscsi/be_mgmt.c:1280:8-16: WARNING: use scnprintf or sprintf
Quoted 1 line
Signed-off-by ztt <[email protected]>
These should all be converted to sysfs_emit instead of scnprintf. Thanks,
- Chris Leech
Quoted 47 lines
--- drivers/scsi/be2iscsi/be_mgmt.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/scsi/be2iscsi/be_mgmt.c +2
-2@@ -1142,7 +1142,7 @@ ssize_t beiscsi_drvr_ver_disp(struct device *dev, struct device_attribute *attr, char *buf) { - return snprintf(buf, PAGE_SIZE, BE_NAME "\n"); + return scnprintf(buf, PAGE_SIZE, BE_NAME "\n"); }/** @@ -1161,7 +1161,7 @@ beiscsi_fw_ver_disp(struct device *dev, structdevice_attribute *attr, struct Scsi_Host *shost = class_to_shost(dev);struct beiscsi_hba *phba =iscsi_host_priv (shost); -return snprintf (buf,PAGE_SIZE ,"%s\n" , phba->fw_ver_str); +return scnprintf (buf,PAGE_SIZE ,"%s\n" , phba->fw_ver_str); }/**
drivers/scsi/be2iscsi/be_mgmt.c +1
-1@@ -1248,7 +1248,7 @@ beiscsi_adap_family_disp(struct device *dev, struct device_attribute *attr, case BE_DEVICE_ID1:case OC_DEVICE_ID1 :case OC_DEVICE_ID2 : -return snprintf (buf,PAGE_SIZE , +return scnprintf (buf,PAGE_SIZE ,"Obsolete/Unsupported BE2 Adapter Family\n" );case BE_DEVICE_ID2 :case
OC_DEVICE_ID3:drivers/scsi/be2iscsi/be_mgmt.c +1
-1@@ -1277,7 +1277,7 @@ beiscsi_phys_port_disp(struct device *dev, structdevice_attribute *attr, struct Scsi_Host *shost = class_to_shost(dev);struct beiscsi_hba *phba =iscsi_host_priv (shost); -return snprintf (buf,PAGE_SIZE ,"Port Identifier : %u\n" , +return scnprintf (buf,PAGE_SIZE ,"Port Identifier : %u\n" , phba->fw_config.phys_port); }