Skip to contentSkip to conversation

scsi: qedi: Couple of warning fixes

PATCH Superseded Florian Fainelli 2 participants 8 messages Nov 26, 2021 – Nov 27, 2021

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover scsi: qedi: Couple of warning fixes

These warnings started to show up after enabling PCI on BMIPS (32-bit MIPS architecture) and were reported by the kbuild robot.

I don't know whether they are technically correct, in particular the unused 'page' variable might be unveiling a genuine bug whereby it should have been used. Please review.

Florian Fainelli (2):
scsi: qedi: Remove set but unused 'page' variable
scsi: qedi: Fix SYSFS_FLAG_FW_SEL_BOOT formatting

 drivers/scsi/qedi/qedi_main.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/2 scsi: qedi: Remove set but unused 'page' variable

The variable page is set but never used throughout qedi_alloc_bdq() therefore remove it.

---
 drivers/scsi/qedi/qedi_main.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/scsi/qedi/qedi_main.c +0 -3
index 1dec814d8788..f1c933070884 100644
@@ -1538,7 +1538,6 @@ static int qedi_alloc_bdq(struct qedi_ctx *qedi)
 	int i;
 	struct scsi_bd *pbl;
 	u64 *list;
-	dma_addr_t page;
 
 	/* Alloc dma memory for BDQ buffers */
 	for (i = 0; i < QEDI_BDQ_NUM; i++) {
@@ -1608,11 +1607,9 @@ static int qedi_alloc_bdq(struct qedi_ctx *qedi)
 	qedi->bdq_pbl_list_num_entries = qedi->bdq_pbl_mem_size /
 					 QEDI_PAGE_SIZE;
 	list = (u64 *)qedi->bdq_pbl_list;
-	page = qedi->bdq_pbl_list_dma;
 	for (i = 0; i < qedi->bdq_pbl_list_num_entries; i++) {
 		*list = qedi->bdq_pbl_dma;
 		list++;
-		page += QEDI_PAGE_SIZE;
 	}
 
 	return 0;
Signature · 1 line
2.25.1
maintainer Acked-by on v1 1/2
#2 lore raw

RE: [EXT] [PATCH 1/2] scsi: qedi: Remove set but unused 'page' variable

Quoted 51 lines

-----Original Message-----
From: Florian Fainelli <[email protected]>
Sent: Friday, November 26, 2021 10:45 AM
To: [email protected]
Cc: Florian Fainelli <[email protected]>; kernel test robot <[email protected]>; Nilesh Javali <[email protected]>; Manish Rangankar <[email protected]>; GR-QLogic-Storage-Upstream <GR-QLogic- [email protected]>; James E.J. Bottomley <[email protected]>; Martin K. Petersen <[email protected]>; open list:QLOGIC QL41xxx ISCSI DRIVER <[email protected]>
Subject: [EXT] [PATCH 1/2] scsi: qedi: Remove set but unused 'page' variable

External Email

----------------------------------------------------------------------
The variable page is set but never used throughout qedi_alloc_bdq() therefore remove it.

---
 drivers/scsi/qedi/qedi_main.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/scsi/qedi/qedi_main.c index renamed from drivers/scsi/qedi/qedi_main.c +0 -0

1dec814d8788..f1c933070884 100644

drivers/scsi/qedi/qedi_main.c +0 -4
@@ -1538,7 +1538,6 @@ static int qedi_alloc_bdq(struct qedi_ctx *qedi)
 	int i;
 	struct scsi_bd *pbl;
 	u64 *list;
-	dma_addr_t page;
 
 	/* Alloc dma memory for BDQ buffers */
 	for (i = 0; i < QEDI_BDQ_NUM; i++) {
@@ -1608,11 +1607,9 @@ static int qedi_alloc_bdq(struct qedi_ctx *qedi)
 	qedi->bdq_pbl_list_num_entries = qedi->bdq_pbl_mem_size /
 					 QEDI_PAGE_SIZE;
 	list = (u64 *)qedi->bdq_pbl_list;
-	page = qedi->bdq_pbl_list_dma;
 	for (i = 0; i < qedi->bdq_pbl_list_num_entries; i++) {
 		*list = qedi->bdq_pbl_dma;
 		list++;
-		page += QEDI_PAGE_SIZE;
 	}
 
 	return 0;
--
Quoted 1 line

2.25.1

Thanks,

#3 lore raw

Re: [EXT] [PATCH 1/2] scsi: qedi: Remove set but unused 'page' variable

Quoted 49 lines · Manish Rangankar
Quoted 49 lines

-----Original Message-----
From: Florian Fainelli <[email protected]>
Sent: Friday, November 26, 2021 10:45 AM
To: [email protected]
Cc: Florian Fainelli <[email protected]>; kernel test robot <[email protected]>; Nilesh Javali <[email protected]>; Manish Rangankar <[email protected]>; GR-QLogic-Storage-Upstream <GR-QLogic- [email protected]>; James E.J. Bottomley <[email protected]>; Martin K. Petersen <[email protected]>; open list:QLOGIC QL41xxx ISCSI DRIVER <[email protected]>
Subject: [EXT] [PATCH 1/2] scsi: qedi: Remove set but unused 'page' variable

External Email

----------------------------------------------------------------------
The variable page is set but never used throughout qedi_alloc_bdq() therefore remove it.

---
  drivers/scsi/qedi/qedi_main.c | 3 ---
  1 file changed, 3 deletions(-)
drivers/scsi/qedi/qedi_main.c index renamed from drivers/scsi/qedi/qedi_main.c +0 -0

1dec814d8788..f1c933070884 100644

drivers/scsi/qedi/qedi_main.c +0 -3
@@ -1538,7 +1538,6 @@ static int qedi_alloc_bdq(struct qedi_ctx *qedi)
  	int i;
  	struct scsi_bd *pbl;
  	u64 *list;
-	dma_addr_t page;
 
  	/* Alloc dma memory for BDQ buffers */
  	for (i = 0; i < QEDI_BDQ_NUM; i++) {
@@ -1608,11 +1607,9 @@ static int qedi_alloc_bdq(struct qedi_ctx *qedi)
  	qedi->bdq_pbl_list_num_entries = qedi->bdq_pbl_mem_size /
  					 QEDI_PAGE_SIZE;
  	list = (u64 *)qedi->bdq_pbl_list;
-	page = qedi->bdq_pbl_list_dma;
  	for (i = 0; i < qedi->bdq_pbl_list_num_entries; i++) {
  		*list = qedi->bdq_pbl_dma;
  		list++;
-		page += QEDI_PAGE_SIZE;
  	}
 
Quoted 6 lines
Quoted 3 lines
drivers/scsi/qedi/qedi_main.c +0 -1
  	return 0;
--

2.25.1

Thanks,

Thanks for taking a look, does not that make the loop iterating the list even more useless now, though? Should not page have been used for something in that function?

Signature · 1 line
Florian
maintainer
#4 lore raw

RE: [EXT] [PATCH 1/2] scsi: qedi: Remove set but unused 'page' variable

Quoted 15 lines
Quoted 8 lines
Quoted 8 lines
  	list = (u64 *)qedi->bdq_pbl_list;
drivers/scsi/qedi/qedi_main.c +0 -2
-	page = qedi->bdq_pbl_list_dma;
  	for (i = 0; i < qedi->bdq_pbl_list_num_entries; i++) {
  		*list = qedi->bdq_pbl_dma;
  		list++;
-		page += QEDI_PAGE_SIZE;
  	}
Quoted 6 lines
Quoted 3 lines

return 0;
--
2.25.1

Thanks,

Quoted 4 lines

Thanks for taking a look, does not that make the loop iterating the list even more useless now, though? Should not page have been used for something in that function?
--

We need list to build structure of bdq list in firmware understandable format.

#5 lore raw

PATCH 2/2 scsi: qedi: Fix SYSFS_FLAG_FW_SEL_BOOT formatting

In reply to Florian Fainelli

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 use %d since this is a plain integer.

---
 drivers/scsi/qedi/qedi_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qedi/qedi_main.c +1 -1
index f1c933070884..367a0337b53e 100644
@@ -2254,7 +2254,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, "%d\n", SYSFS_FLAG_FW_SEL_BOOT);
 		break;
 	case ISCSI_BOOT_TGT_NIC_ASSOC:
 		rc = snprintf(buf, 3, "0\n");
Signature · 1 line
2.25.1
maintainer
#6 lore raw

RE: [EXT] [PATCH 2/2] scsi: qedi: Fix SYSFS_FLAG_FW_SEL_BOOT formatting

Quoted 43 lines

-----Original Message-----
From: Florian Fainelli <[email protected]>
Sent: Friday, November 26, 2021 10:45 AM
To: [email protected]
Cc: Florian Fainelli <[email protected]>; Nilesh Javali <[email protected]>; Manish Rangankar <[email protected]>; GR-QLogic-Storage-Upstream <[email protected]>; James E.J. Bottomley <[email protected]>; Martin K. Petersen <[email protected]>; open list:QLOGIC QL41xxx ISCSI DRIVER <[email protected]>
Subject: [EXT] [PATCH 2/2] scsi: qedi: Fix SYSFS_FLAG_FW_SEL_BOOT formatting

External Email

----------------------------------------------------------------------
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 use %d since this is a plain integer.

---
 drivers/scsi/qedi/qedi_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qedi/qedi_main.c index renamed from drivers/scsi/qedi/qedi_main.c +0 -0

f1c933070884..367a0337b53e 100644

drivers/scsi/qedi/qedi_main.c +1 -1
@@ -2254,7 +2254,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, "%d\n", SYSFS_FLAG_FW_SEL_BOOT);
 		break;
 	case ISCSI_BOOT_TGT_NIC_ASSOC:
Quoted 3 lines

rc = snprintf(buf, 3, "0\n");
--
2.25.1

SYSFS_FLAG_FW_SEL_BOOT is always going to have value 2, that's why it is given %hhd to limit the size to 1 byte. Is there other way to suppress this warning, such as typecasting or any other ?

#7 lore raw

Re: [EXT] [PATCH 2/2] scsi: qedi: Fix SYSFS_FLAG_FW_SEL_BOOT formatting

Quoted 41 lines · Manish Rangankar
Quoted 41 lines

-----Original Message-----
From: Florian Fainelli <[email protected]>
Sent: Friday, November 26, 2021 10:45 AM
To: [email protected]
Cc: Florian Fainelli <[email protected]>; Nilesh Javali <[email protected]>; Manish Rangankar <[email protected]>; GR-QLogic-Storage-Upstream <[email protected]>; James E.J. Bottomley <[email protected]>; Martin K. Petersen <[email protected]>; open list:QLOGIC QL41xxx ISCSI DRIVER <[email protected]>
Subject: [EXT] [PATCH 2/2] scsi: qedi: Fix SYSFS_FLAG_FW_SEL_BOOT formatting

External Email

----------------------------------------------------------------------
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 use %d since this is a plain integer.

---
  drivers/scsi/qedi/qedi_main.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qedi/qedi_main.c index renamed from drivers/scsi/qedi/qedi_main.c +0 -0

f1c933070884..367a0337b53e 100644

drivers/scsi/qedi/qedi_main.c +1 -1
@@ -2254,7 +2254,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, "%d\n", SYSFS_FLAG_FW_SEL_BOOT);
Quoted 8 lines
Quoted 5 lines
drivers/scsi/qedi/qedi_main.c +0 -0
  		break;
  	case ISCSI_BOOT_TGT_NIC_ASSOC:

rc = snprintf(buf, 3, "0\n");
--
2.25.1

SYSFS_FLAG_FW_SEL_BOOT is always going to have value 2, that's why it is given %hhd to limit the size to 1 byte. Is there other way to suppress this warning, such as typecasting or any other ?

Yes typecasting would work, if you are fine with that.

Signature · 1 line
Florian