Skip to contentSkip to conversation

Rid W=1 warnings in SCSI

PATCH Applied Lee Jones 3 participants 12 messages Mar 17, 2021 – Mar 19, 2021

Subsystems (4)

v2 of 3 Applied Latest is v3 →

lore
Share & tools
lore

Lee Jones

author
#0 lore raw

v2 cover Rid W=1 warnings in SCSI

This set contains functional changes.

This set is part of a larger effort attempting to clean-up W=1 kernel builds, which are currently overwhelmingly riddled with niggly little warnings.

Lee Jones (8):
scsi: BusLogic: Supply __printf(x, y) formatting for blogic_msg()
scsi: nsp32: Supply __printf(x, y) formatting for nsp32_message()
scsi: nsp32: Remove or exclude unused variables
scsi: FlashPoint: Remove unused variable 'TID' from
'FlashPoint_AbortCCB()'
scsi: sim710: Remove unused variable 'err' from sim710_init()
scsi: isci: remote_device: Make local function
isci_remote_device_wait_for_resume_from_abort() static
scsi: isci: port: Make local function 'port_state_name()' static
scsi: nsp32: Correct expected types in debug print formatting

 drivers/scsi/BusLogic.c           |  2 +-
 drivers/scsi/FlashPoint.c         |  4 ----
 drivers/scsi/isci/port.c          |  2 +-
 drivers/scsi/isci/remote_device.c |  2 +-
 drivers/scsi/nsp32.c              | 31 +++++++++----------------------
 drivers/scsi/sim710.c             | 14 ++++++--------
 6 files changed, 18 insertions(+), 37 deletions(-)
Cc Artur Paszkiewicz <[email protected]>
Cc GOTO Masanori <[email protected]>
Cc "James E.J. Bottomley" <[email protected]>
Cc Khalid Aziz <[email protected]>
Cc "Leonard N. Zubkoff" <[email protected]>
Cc "Martin K. Petersen" <[email protected]>
Cc Richard Hirst <[email protected]>
Cc YOKOTA Hiroshi <[email protected]>
Signature · 1 line
2.27.0
author
#1 lore raw

PATCH v2 1/8 scsi: BusLogic: Supply __printf(x, y) formatting for blogic_msg()

Fixes the following W=1 kernel build warning(s):

In file included from drivers/scsi/BusLogic.c:51:
drivers/scsi/BusLogic.c: In function ‘blogic_msg’:
drivers/scsi/BusLogic.c:3591:2: warning: function ‘blogic_msg’ might be a candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]

Cc Khalid Aziz <[email protected]>
Cc "James E.J. Bottomley" <[email protected]>
Cc "Martin K. Petersen" <[email protected]>
Cc "Leonard N. Zubkoff" <[email protected]>
---
 drivers/scsi/BusLogic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/BusLogic.c +1 -1
index ccb061ab0a0ad..0ac3f713fc212 100644
@@ -3578,7 +3578,7 @@ Target	Requested Completed  Requested Completed  Requested Completed\n\
 /*
   blogic_msg prints Driver Messages.
 */
-
+__printf(2, 4)
 static void blogic_msg(enum blogic_msglevel msglevel, char *fmt,
 			struct blogic_adapter *adapter, ...)
 {
Signature · 1 line
2.27.0
maintainer Acked-by on v2 1/8
#2 lore raw

Re: [PATCH 1/8] scsi: BusLogic: Supply __printf(x, y) formatting for blogic_msg()

Quoted 22 lines · Lee Jones

Fixes the following W=1 kernel build warning(s):

In file included from drivers/scsi/BusLogic.c:51:
drivers/scsi/BusLogic.c: In function ‘blogic_msg’:
drivers/scsi/BusLogic.c:3591:2: warning: function ‘blogic_msg’ might be a candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]

Cc Khalid Aziz <[email protected]>
Cc "James E.J. Bottomley" <[email protected]>
Cc "Martin K. Petersen" <[email protected]>
Cc "Leonard N. Zubkoff" <[email protected]>
---
 drivers/scsi/BusLogic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/BusLogic.c +0 -0
index ccb061ab0a0ad..0ac3f713fc212 100644

drivers/scsi/BusLogic.c Target Requested Completed Requested Completed Requested Completed\n\ · line 3584

Quoted 8 lines
drivers/scsi/BusLogic.c +1 -1
@@ -3578,7 +3578,7 @@ Target	Requested Completed  Requested Completed  Requested Completed\n\
 /*
   blogic_msg prints Driver Messages.
 */
-
+__printf(2, 4)
 static void blogic_msg(enum blogic_msglevel msglevel, char *fmt,
 			struct blogic_adapter *adapter, ...)
 {
author
#3 lore raw

PATCH v2 2/8 scsi: nsp32: Supply __printf(x, y) formatting for nsp32_message()

In reply to Lee Jones

Fixes the following W=1 kernel build warning(s):

drivers/scsi/nsp32.c: In function ‘nsp32_message’:
drivers/scsi/nsp32.c:318:2: warning: function ‘nsp32_message’ might be a candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]

Cc GOTO Masanori <[email protected]>
Cc YOKOTA Hiroshi <[email protected]>
Cc "James E.J. Bottomley" <[email protected]>
Cc "Martin K. Petersen" <[email protected]>
---
 drivers/scsi/nsp32.c | 1 +
 1 file changed, 1 insertion(+)
drivers/scsi/nsp32.c +1 -0
index e44b1a0f67099..d5aa96f05bce4 100644
@@ -309,6 +309,7 @@ static struct scsi_host_template nsp32_template = {
 
 #define NSP32_DEBUG_BUF_LEN		100
 
+__printf(4, 5)
 static void nsp32_message(const char *func, int line, char *type, char *fmt, ...)
 {
 	va_list args;
Signature · 1 line
2.27.0
author
#4 lore raw

PATCH v2 3/8 scsi: nsp32: Remove or exclude unused variables

In reply to Lee Jones

Fixes the following W=1 kernel build warning(s):

drivers/scsi/nsp32.c: In function ‘nsp32_selection_autoscsi’:
drivers/scsi/nsp32.c:584:17: warning: variable ‘execph’ set but not used [-Wunused-but-set-variable] drivers/scsi/nsp32.c: In function ‘nsp32_msgout_occur’:
drivers/scsi/nsp32.c:1785:7: warning: variable ‘new_sgtp’ set but not used [-Wunused-but-set-variable] drivers/scsi/nsp32.c: In function ‘nsp32_analyze_sdtr’:
drivers/scsi/nsp32.c:2227:20: warning: variable ‘syncnum’ set but not used [-Wunused-but-set-variable] drivers/scsi/nsp32.c:2223:20: warning: variable ‘synct’ set but not used [-Wunused-but-set-variable] drivers/scsi/nsp32.c: In function ‘nsp32_do_bus_reset’:
drivers/scsi/nsp32.c:2841:17: warning: variable ‘intrdat’ set but not used [-Wunused-but-set-variable] drivers/scsi/nsp32.c: In function ‘nsp32_getprom_param’:
drivers/scsi/nsp32.c:2912:11: warning: variable ‘val’ set but not used [-Wunused-but-set-variable]

Cc GOTO Masanori <[email protected]>
Cc YOKOTA Hiroshi <[email protected]>
Cc "James E.J. Bottomley" <[email protected]>
Cc "Martin K. Petersen" <[email protected]>
---
 drivers/scsi/nsp32.c | 23 ++++-------------------
 1 file changed, 4 insertions(+), 19 deletions(-)
drivers/scsi/nsp32.c +4 -19
index d5aa96f05bce4..54abda4d07c64 100644
@@ -581,7 +581,6 @@ static int nsp32_selection_autoscsi(struct scsi_cmnd *SCpnt)
 	int		status;
 	unsigned short	command	= 0;
 	unsigned int	msgout  = 0;
-	unsigned short	execph;
 	int		i;
 
 	nsp32_dbg(NSP32_DEBUG_AUTOSCSI, "in");
@@ -605,7 +604,7 @@ static int nsp32_selection_autoscsi(struct scsi_cmnd *SCpnt)
 	/*
 	 * clear execph
 	 */
-	execph = nsp32_read2(base, SCSI_EXECUTE_PHASE);
+	nsp32_read2(base, SCSI_EXECUTE_PHASE);
 
 	/*
 	 * clear FIFO counter to set CDBs
@@ -1781,8 +1780,6 @@ static void nsp32_msgout_occur(struct scsi_cmnd *SCpnt)
 {
 	nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
 	unsigned int base   = SCpnt->device->host->io_port;
-	//unsigned short command;
-	long new_sgtp;
 	int i;
 	
 	nsp32_dbg(NSP32_DEBUG_MSGOUTOCCUR,
@@ -1796,14 +1793,6 @@ static void nsp32_msgout_occur(struct scsi_cmnd *SCpnt)
 		nsp32_build_nop(SCpnt);
 	}
 
-	/*
-	 * Set SGTP ADDR current entry for restarting AUTOSCSI, 
-	 * because SGTP is incremented next point.
-	 * There is few statement in the specification...
-	 */
- 	new_sgtp = data->cur_lunt->sglun_paddr + 
-		   (data->cur_lunt->cur_entry * sizeof(nsp32_sgtable));
-
 	/*
 	 * send messages
 	 */
@@ -2220,17 +2209,12 @@ static void nsp32_analyze_sdtr(struct scsi_cmnd *SCpnt)
 {
 	nsp32_hw_data   *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
 	nsp32_target     *target     = data->cur_target;
-	nsp32_sync_table *synct;
 	unsigned char     get_period = data->msginbuf[3];
 	unsigned char     get_offset = data->msginbuf[4];
 	int               entry;
-	int               syncnum;
 
 	nsp32_dbg(NSP32_DEBUG_MSGINOCCUR, "enter");
 
-	synct   = data->synct;
-	syncnum = data->syncnum;
-
 	/*
 	 * If this inititor sent the SDTR message, then target responds SDTR,
 	 * initiator SYNCREG, ACKWIDTH from SDTR parameter.
@@ -2838,8 +2822,8 @@ static int nsp32_eh_abort(struct scsi_cmnd *SCpnt)
 static void nsp32_do_bus_reset(nsp32_hw_data *data)
 {
 	unsigned int   base = data->BaseAddress;
-	unsigned short intrdat;
 	int i;
+	unsigned short __maybe_unused intrdat;
 
 	nsp32_dbg(NSP32_DEBUG_BUSRESET, "in");
 
@@ -2909,7 +2893,8 @@ static int nsp32_getprom_param(nsp32_hw_data *data)
 {
 	int vendor = data->pci_devid->vendor;
 	int device = data->pci_devid->device;
-	int ret, val, i;
+	int ret, i;
+	int __maybe_unused val;
 
 	/*
 	 * EEPROM checking.
Signature · 1 line
2.27.0
author
#5 lore raw

PATCH v2 4/8 scsi: FlashPoint: Remove unused variable 'TID' from 'FlashPoint_AbortCCB()'

In reply to Lee Jones

Fixes the following W=1 kernel build warning(s):

drivers/scsi/FlashPoint.c: In function ‘FlashPoint_AbortCCB’:
drivers/scsi/FlashPoint.c:1618:16: warning: variable ‘TID’ set but not used [-Wunused-but-set-variable]

Cc Khalid Aziz <[email protected]>
Cc "James E.J. Bottomley" <[email protected]>
Cc "Martin K. Petersen" <[email protected]>
---
 drivers/scsi/FlashPoint.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/scsi/FlashPoint.c +0 -4
index f479c542e787c..0464e37c806a4 100644
@@ -1615,7 +1615,6 @@ static int FlashPoint_AbortCCB(void *pCurrCard, struct sccb *p_Sccb)
 
 	unsigned char thisCard;
 	CALL_BK_FN callback;
-	unsigned char TID;
 	struct sccb *pSaveSCCB;
 	struct sccb_mgr_tar_info *currTar_Info;
 
@@ -1652,9 +1651,6 @@ static int FlashPoint_AbortCCB(void *pCurrCard, struct sccb *p_Sccb)
 			}
 
 			else {
-
-				TID = p_Sccb->TargID;
-
 				if (p_Sccb->Sccb_tag) {
 					MDISABLE_INT(ioport);
 					if (((struct sccb_card *)pCurrCard)->
Signature · 1 line
2.27.0
maintainer Acked-by on v2 4/8
#6 lore raw

Re: [PATCH 4/8] scsi: FlashPoint: Remove unused variable 'TID' from 'FlashPoint_AbortCCB()'

Quoted 28 lines · Lee Jones

Fixes the following W=1 kernel build warning(s):

drivers/scsi/FlashPoint.c: In function ‘FlashPoint_AbortCCB’:
drivers/scsi/FlashPoint.c:1618:16: warning: variable ‘TID’ set but not used [-Wunused-but-set-variable]

Cc Khalid Aziz <[email protected]>
Cc "James E.J. Bottomley" <[email protected]>
Cc "Martin K. Petersen" <[email protected]>
---
 drivers/scsi/FlashPoint.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/scsi/FlashPoint.c +0 -1
index f479c542e787c..0464e37c806a4 100644
@@ -1615,7 +1615,6 @@ static int FlashPoint_AbortCCB(void *pCurrCard, struct sccb *p_Sccb)
 
 	unsigned char thisCard;
 	CALL_BK_FN callback;
-	unsigned char TID;
 	struct sccb *pSaveSCCB;
 	struct sccb_mgr_tar_info *currTar_Info;
 

drivers/scsi/FlashPoint.c static int FlashPoint_AbortCCB(void *pCurrCard, struct sccb *p_Sccb) · line 1656

Quoted 9 lines
drivers/scsi/FlashPoint.c +0 -3
@@ -1652,9 +1651,6 @@ static int FlashPoint_AbortCCB(void *pCurrCard, struct sccb *p_Sccb)
 			}
 
 			else {
-
-				TID = p_Sccb->TargID;
-
 				if (p_Sccb->Sccb_tag) {
 					MDISABLE_INT(ioport);
 					if (((struct sccb_card *)pCurrCard)->
author
#7 lore raw

PATCH v2 5/8 scsi: sim710: Remove unused variable 'err' from sim710_init()

In reply to Lee Jones

Take the opportunity to rework the comment a little.

Fixes the following W=1 kernel build warning(s):

drivers/scsi/sim710.c: In function ‘sim710_init’:
drivers/scsi/sim710.c:216:6: warning: variable ‘err’ set but not used [-Wunused-but-set-variable]

Cc "James E.J. Bottomley" <[email protected]>
Cc "Martin K. Petersen" <[email protected]>
Cc Richard Hirst <[email protected]>
---
 drivers/scsi/sim710.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
drivers/scsi/sim710.c +6 -8
index 22302612e032b..e519df68d603d 100644
@@ -213,21 +213,19 @@ static struct eisa_driver sim710_eisa_driver = {
 
 static int __init sim710_init(void)
 {
-	int err = -ENODEV;
-
 #ifdef MODULE
 	if (sim710)
 		param_setup(sim710);
 #endif
 
 #ifdef CONFIG_EISA
-	err = eisa_driver_register(&sim710_eisa_driver);
+	/*
+	 * FIXME: We'd really like to return -ENODEV if no devices have actually
+	 * been found.  However eisa_driver_register() only reports problems
+	 * with kobject_register() so simply return success for now.
+	 */
+	eisa_driver_register(&sim710_eisa_driver);
 #endif
-	/* FIXME: what we'd really like to return here is -ENODEV if
-	 * no devices have actually been found.  Instead, the err
-	 * above actually only reports problems with kobject_register,
-	 * so for the moment return success */
-
 	return 0;
 }
 
Signature · 1 line
2.27.0
author
#8 lore raw

PATCH v2 6/8 scsi: isci: remote_device: Make local function isci_remote_device_wait_for_resume_from_abort() static

In reply to Lee Jones

Fixes the following W=1 kernel build warning(s):

drivers/scsi/isci/remote_device.c:1387:6: warning: no previous prototype for ‘isci_remote_device_wait_for_resume_from_abort’ [-Wmissing-prototypes]

Cc Artur Paszkiewicz <[email protected]>
Cc "James E.J. Bottomley" <[email protected]>
Cc "Martin K. Petersen" <[email protected]>
---
 drivers/scsi/isci/remote_device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/isci/remote_device.c +1 -1
index c3f540b556895..b1276f7e49c89 100644
@@ -1384,7 +1384,7 @@ static bool isci_remote_device_test_resume_done(
 	return done;
 }
 
-void isci_remote_device_wait_for_resume_from_abort(
+static void isci_remote_device_wait_for_resume_from_abort(
 	struct isci_host *ihost,
 	struct isci_remote_device *idev)
 {
Signature · 1 line
2.27.0
author
#9 lore raw

PATCH v2 7/8 scsi: isci: port: Make local function 'port_state_name()' static

In reply to Lee Jones

Fixes the following W=1 kernel build warning(s):

drivers/scsi/isci/port.c:65:13: warning: no previous prototype for ‘port_state_name’ [-Wmissing-prototypes]

Cc Artur Paszkiewicz <[email protected]>
Cc "James E.J. Bottomley" <[email protected]>
Cc "Martin K. Petersen" <[email protected]>
---
 drivers/scsi/isci/port.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/isci/port.c +1 -1
index 448a8c31ba359..5a362ba76d63f 100644
@@ -62,7 +62,7 @@
 
 #undef C
 #define C(a) (#a)
-const char *port_state_name(enum sci_port_states state)
+static const char *port_state_name(enum sci_port_states state)
 {
 	static const char * const strings[] = PORT_STATES;
 
Signature · 1 line
2.27.0
author
#10 lore raw

PATCH v2 8/8 scsi: nsp32: Correct expected types in debug print formatting

In reply to Lee Jones

Fixes the following W=1 kernel build warning(s):

drivers/scsi/nsp32.c: In function ‘nsp32_setup_sg_table’:
drivers/scsi/nsp32.c:879:6: warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 5 has type ‘unsigned int’ [-Wformat=] drivers/scsi/nsp32.c:280:69: note: in definition of macro ‘nsp32_msg’
drivers/scsi/nsp32.c:879:52: note: format string is defined here
drivers/scsi/nsp32.c: In function ‘nsp32_detect’:
drivers/scsi/nsp32.c:2719:6: warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 5 has type ‘int’ [-Wformat=] drivers/scsi/nsp32.c:280:69: note: in definition of macro ‘nsp32_msg’
drivers/scsi/nsp32.c:2719:22: note: format string is defined here
drivers/scsi/nsp32.c:2719:6: warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 6 has type ‘int’ [-Wformat=] drivers/scsi/nsp32.c:280:69: note: in definition of macro ‘nsp32_msg’
drivers/scsi/nsp32.c:2719:28: note: format string is defined here
drivers/scsi/nsp32.c: In function ‘nsp32_suspend’:
drivers/scsi/nsp32.c:3267:23: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 6 has type ‘pm_message_t’ {aka ‘struct pm_message’} [-Wformat=] drivers/scsi/nsp32.c:280:69: note: in definition of macro ‘nsp32_msg’
drivers/scsi/nsp32.c:3267:56: note: format string is defined here

Cc GOTO Masanori <[email protected]>
Cc YOKOTA Hiroshi <[email protected]>
Cc "James E.J. Bottomley" <[email protected]>
Cc "Martin K. Petersen" <[email protected]>
---
 drivers/scsi/nsp32.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/scsi/nsp32.c +4 -3
index 54abda4d07c64..134bbd2d8b667 100644
@@ -876,7 +876,7 @@ static int nsp32_setup_sg_table(struct scsi_cmnd *SCpnt)
 
 			if (le32_to_cpu(sgt[i].len) > 0x10000) {
 				nsp32_msg(KERN_ERR,
-					"can't transfer over 64KB at a time, size=0x%lx", le32_to_cpu(sgt[i].len));
+					"can't transfer over 64KB at a time, size=0x%x", le32_to_cpu(sgt[i].len));
 				return FALSE;
 			}
 			nsp32_dbg(NSP32_DEBUG_SGLIST,
@@ -2716,7 +2716,7 @@ static int nsp32_detect(struct pci_dev *pdev)
 	res = request_region(host->io_port, host->n_io_port, "nsp32");
 	if (res == NULL) {
 		nsp32_msg(KERN_ERR, 
-			  "I/O region 0x%lx+0x%lx is already used",
+			  "I/O region 0x%x+0x%x is already used",
 			  data->BaseAddress, data->NumAddress);
 		goto free_irq;
         }
@@ -3264,7 +3264,8 @@ static int nsp32_suspend(struct pci_dev *pdev, pm_message_t state)
 {
 	struct Scsi_Host *host = pci_get_drvdata(pdev);
 
-	nsp32_msg(KERN_INFO, "pci-suspend: pdev=0x%p, state=%ld, slot=%s, host=0x%p", pdev, state, pci_name(pdev), host);
+	nsp32_msg(KERN_INFO, "pci-suspend: pdev=0x%p, state.event=%x, slot=%s, host=0x%p",
+		  pdev, state.event, pci_name(pdev), host);
 
 	pci_save_state     (pdev);
 	pci_disable_device (pdev);
Signature · 1 line
2.27.0
#11 lore raw
In reply to Lee Jones

Lee,

Quoted 5 lines

This set contains functional changes.

This set is part of a larger effort attempting to clean-up W=1 kernel builds, which are currently overwhelmingly riddled with niggly little warnings.

Applied to 5.13/scsi-staging, thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering