Skip to contentSkip to conversation

advansys: fix build warning for PCI=n

PATCH Applied Arnd Bergmann 3 participants 3 messages Oct 24, 2016 – Oct 27, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 advansys: fix build warning for PCI=n

The advansys probe function tries to handle both ISA and PCI cases, each hidden in an #ifdef when unused. This leads to a warning indicating that when PCI is disabled we could be using uninitialized data:

drivers/scsi/advansys.c: In function ‘advansys_board_found’:
drivers/scsi/advansys.c:11036:5: error: ‘ret’ may be used uninitialized in this function [-Werror=maybe-uninitialized] drivers/scsi/advansys.c:10928:28: note: ‘ret’ was declared here
drivers/scsi/advansys.c:11309:8: error: ‘share_irq’ may be used uninitialized in this function [-Werror=maybe-uninitialized] drivers/scsi/advansys.c:10928:6: note: ‘share_irq’ was declared here

This cannot happen in practice because the hardware in question only exists for PCI, but changing the code to just error out here is better for consistency and avoids the warning.

---
 drivers/scsi/advansys.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/scsi/advansys.c +3 -0
index febbd83e2ecd..81dd0927246b 100644
@@ -11030,6 +11030,9 @@ static int advansys_board_found(struct Scsi_Host *shost, unsigned int iop,
 		ASC_DBG(2, "AdvInitGetConfig()\n");
 
 		ret = AdvInitGetConfig(pdev, shost) ? -ENODEV : 0;
+#else
+		share_irq = 0;
+		ret = -ENODEV;
 #endif /* CONFIG_PCI */
 	}
 
Signature · 1 line
2.9.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 26 lines · Arnd Bergmann

The advansys probe function tries to handle both ISA and PCI cases, each hidden in an #ifdef when unused. This leads to a warning indicating that when PCI is disabled we could be using uninitialized data:

drivers/scsi/advansys.c: In function ‘advansys_board_found’:
drivers/scsi/advansys.c:11036:5: error: ‘ret’ may be used uninitialized in this function [-Werror=maybe-uninitialized] drivers/scsi/advansys.c:10928:28: note: ‘ret’ was declared here
drivers/scsi/advansys.c:11309:8: error: ‘share_irq’ may be used uninitialized in this function [-Werror=maybe-uninitialized] drivers/scsi/advansys.c:10928:6: note: ‘share_irq’ was declared here

This cannot happen in practice because the hardware in question only exists for PCI, but changing the code to just error out here is better for consistency and avoids the warning.

---
 drivers/scsi/advansys.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/scsi/advansys.c +0 -0
index febbd83e2ecd..81dd0927246b 100644

drivers/scsi/advansys.c static int advansys_board_found(struct Scsi_Host *shost, unsigned int iop, · line 11038

Quoted 9 lines
drivers/scsi/advansys.c +3 -0
@@ -11030,6 +11030,9 @@ static int advansys_board_found(struct Scsi_Host *shost, unsigned int iop,
 		ASC_DBG(2, "AdvInitGetConfig()\n");
 
 		ret = AdvInitGetConfig(pdev, shost) ? -ENODEV : 0;
+#else
+		share_irq = 0;
+		ret = -ENODEV;
 #endif /* CONFIG_PCI */
 	}
 

Cheers,

Hannes

Signature · 5 lines
Dr. Hannes Reinecke		               zSeries & Storage
[email protected]			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
#2 lore raw
In reply to Arnd Bergmann
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Arnd" == Arnd Bergmann <[email protected]> writes:

Arnd> The advansys probe function tries to handle both ISA and PCI Arnd> cases, each hidden in an #ifdef when unused. This leads to a Arnd> warning indicating that when PCI is disabled we could be using Arnd> uninitialized data:

Arnd> drivers/scsi/advansys.c: In function ‘advansys_board_found’:
Arnd> drivers/scsi/advansys.c:11036:5: error: ‘ret’ may be used Arnd> uninitialized in this function [-Werror=maybe-uninitialized] Arnd> drivers/scsi/advansys.c:10928:28: note: ‘ret’ was declared here Arnd> drivers/scsi/advansys.c:11309:8: error: ‘share_irq’ may be used Arnd> uninitialized in this function [-Werror=maybe-uninitialized] Arnd> drivers/scsi/advansys.c:10928:6: note: ‘share_irq’ was declared Arnd> here

Arnd> This cannot happen in practice because the hardware in question Arnd> only exists for PCI, but changing the code to just error out here Arnd> is better for consistency and avoids the warning.

Applied to 4.10/scsi-queue.

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering