Skip to contentSkip to conversation

scsi: SYSFS_FLAG_FW_SEL_BOOT formatting fixes

PATCH Superseded Florian Fainelli 1 participant 4 messages Nov 30, 2021

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover scsi: SYSFS_FLAG_FW_SEL_BOOT formatting fixes

Hi Martin, Manish,

This patch series aligns the formatting of SYSFS_FLAG_FW_SEL_BOOT between qedi and qla4xxx.

Florian Fainelli (2):
scsi: qedi: Fix SYSFS_FLAG_FW_SEL_BOOT formatting
scsi: qla4xxx: Format SYSFS_FLAG_FW_SEL_BOOT as byte

 drivers/scsi/qedi/qedi_main.c | 5 ++---
 drivers/scsi/qla4xxx/ql4_os.c | 4 ++--
 2 files changed, 4 insertions(+), 5 deletions(-)
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/2 scsi: qedi: Fix SYSFS_FLAG_FW_SEL_BOOT formatting

The format used for formatting SYSFS_FLAG_FW_SEL_BOOT creates the following warning:

drivers/scsi/qedi/qedi_main.c:2259:35: warning: format specifies type 'char' but the argument has type 'int' [-Wformat]

                   rc = snprintf(buf, 3, "%hhd\n",

SYSFS_FLAG_FW_SEL_BOOT);

Fix this to cast the constant as a char since the intention is to print it via sysfs as a byte.

---
 drivers/scsi/qedi/qedi_main.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/scsi/qedi/qedi_main.c +2 -3
index f1c933070884..e7d2bc9026f8 100644
@@ -2086,8 +2086,7 @@ static ssize_t qedi_show_boot_eth_info(void *data, int type, char *buf)
 		rc = snprintf(buf, ip_len, fmt, gw);
 		break;
 	case ISCSI_BOOT_ETH_FLAGS:
-		rc = snprintf(buf, 3, "%hhd\n",
-			      SYSFS_FLAG_FW_SEL_BOOT);
+		rc = snprintf(buf, 3, "%hhd\n", (char)SYSFS_FLAG_FW_SEL_BOOT);
 		break;
 	case ISCSI_BOOT_ETH_INDEX:
 		rc = snprintf(buf, 3, "0\n");
@@ -2254,7 +2253,7 @@ qedi_show_boot_tgt_info(struct qedi_ctx *qedi, int type,
 			     mchap_secret);
 		break;
 	case ISCSI_BOOT_TGT_FLAGS:
-		rc = snprintf(buf, 3, "%hhd\n", SYSFS_FLAG_FW_SEL_BOOT);
+		rc = snprintf(buf, 3, "%hhd\n", (char)SYSFS_FLAG_FW_SEL_BOOT);
 		break;
 	case ISCSI_BOOT_TGT_NIC_ASSOC:
 		rc = snprintf(buf, 3, "0\n");
Signature · 1 line
2.25.1
#2 lore raw

PATCH 2/2 scsi: qla4xxx: Format SYSFS_FLAG_FW_SEL_BOOT as byte

In reply to Florian Fainelli

qedi formats SYSFS_FLAG_FW_SEL_BOOT as a byte, and the qla4xxx driver does exactly the same thing, align them for consistency.

---
 drivers/scsi/qla4xxx/ql4_os.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/qla4xxx/ql4_os.c +2 -2
index 8987acc24dac..39b2f833eb26 100644
@@ -5734,7 +5734,7 @@ static ssize_t qla4xxx_show_boot_eth_info(void *data, int type, char *buf)
 
 	switch (type) {
 	case ISCSI_BOOT_ETH_FLAGS:
-		rc = sprintf(str, "%d\n", SYSFS_FLAG_FW_SEL_BOOT);
+		rc = sprintf(str, "%hhd\n", (char)SYSFS_FLAG_FW_SEL_BOOT);
 		break;
 	case ISCSI_BOOT_ETH_INDEX:
 		rc = sprintf(str, "0\n");
@@ -5843,7 +5843,7 @@ qla4xxx_show_boot_tgt_info(struct ql4_boot_session_info *boot_sess, int type,
 			     (char *)&boot_conn->chap.intr_secret);
 		break;
 	case ISCSI_BOOT_TGT_FLAGS:
-		rc = sprintf(str, "%d\n", SYSFS_FLAG_FW_SEL_BOOT);
+		rc = sprintf(str, "%hdd\n", (char)SYSFS_FLAG_FW_SEL_BOOT);
 		break;
 	case ISCSI_BOOT_TGT_NIC_ASSOC:
 		rc = sprintf(str, "0\n");
Signature · 1 line
2.25.1
#3 lore raw

Re: [PATCH 2/2] scsi: qla4xxx: Format SYSFS_FLAG_FW_SEL_BOOT as byte

Quoted 23 lines · Florian Fainelli

qedi formats SYSFS_FLAG_FW_SEL_BOOT as a byte, and the qla4xxx driver does exactly the same thing, align them for consistency.

---
 drivers/scsi/qla4xxx/ql4_os.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/qla4xxx/ql4_os.c +1 -1
index 8987acc24dac..39b2f833eb26 100644
@@ -5734,7 +5734,7 @@ static ssize_t qla4xxx_show_boot_eth_info(void *data, int type, char *buf)
 
 	switch (type) {
 	case ISCSI_BOOT_ETH_FLAGS:
-		rc = sprintf(str, "%d\n", SYSFS_FLAG_FW_SEL_BOOT);
+		rc = sprintf(str, "%hhd\n", (char)SYSFS_FLAG_FW_SEL_BOOT);
 		break;
 	case ISCSI_BOOT_ETH_INDEX:
 		rc = sprintf(str, "0\n");

drivers/scsi/qla4xxx/ql4_os.c qla4xxx_show_boot_tgt_info(struct ql4_boot_session_info *boot_sess, int type, · line 5846

Quoted 5 lines
drivers/scsi/qla4xxx/ql4_os.c +1 -1
@@ -5843,7 +5843,7 @@ qla4xxx_show_boot_tgt_info(struct ql4_boot_session_info *boot_sess, int type,
 			     (char *)&boot_conn->chap.intr_secret);
 		break;
 	case ISCSI_BOOT_TGT_FLAGS:
-		rc = sprintf(str, "%d\n", SYSFS_FLAG_FW_SEL_BOOT);
+		rc = sprintf(str, "%hdd\n", (char)SYSFS_FLAG_FW_SEL_BOOT);

Sorry, I botched up that one, let me resend.

Signature · 1 line
Florian