Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1507342 > unrolled thread

[PATCH] advansys: fix build warning for PCI=n

Started byArnd Bergmann <arnd@arndb.de>
First post2016-10-24 18:00 +0200
Last post2016-10-25 08:00 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] advansys: fix build warning for PCI=n Arnd Bergmann <arnd@arndb.de> - 2016-10-24 18:00 +0200
    Re: [PATCH] advansys: fix build warning for PCI=n Hannes Reinecke <hare@suse.com> - 2016-10-25 08:00 +0200

#1507342 — [PATCH] advansys: fix build warning for PCI=n

FromArnd Bergmann <arnd@arndb.de>
Date2016-10-24 18:00 +0200
Subject[PATCH] advansys: fix build warning for PCI=n
Message-ID<svPPj-1bs-15@gated-at.bofh.it>
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.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/scsi/advansys.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
index febbd83e2ecd..81dd0927246b 100644
--- a/drivers/scsi/advansys.c
+++ b/drivers/scsi/advansys.c
@@ -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 */
 	}
 
-- 
2.9.0

[toc] | [next] | [standalone]


#1507990

FromHannes Reinecke <hare@suse.com>
Date2016-10-25 08:00 +0200
Message-ID<sw2Wd-1r5-9@gated-at.bofh.it>
In reply to#1507342
On 10/24/2016 05:51 PM, Arnd Bergmann wrote:
> 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.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/scsi/advansys.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
> index febbd83e2ecd..81dd0927246b 100644
> --- a/drivers/scsi/advansys.c
> +++ b/drivers/scsi/advansys.c
> @@ -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 */
>  	}
>  
> 
Reviewed-by: Hannes Reinecke <hare@suse.com>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		               zSeries & Storage
hare@suse.com			               +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)

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web