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

From: Hannes Reinecke
Date: Tue Oct 25 2016 - 01:57:36 EST


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@xxxxxxxx>
> ---
> 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@xxxxxxxx>

Cheers,

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