Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932109AbdHWPCA (ORCPT ); Wed, 23 Aug 2017 11:02:00 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:57072 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754129AbdHWPB7 (ORCPT ); Wed, 23 Aug 2017 11:01:59 -0400 From: Arnd Bergmann To: James Smart , Dick Kennedy , "James E.J. Bottomley" , "Martin K. Petersen" Cc: Arnd Bergmann , Hannes Reinecke , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] scsi: lpfc: avoid false-positive gcc-8 warning Date: Wed, 23 Aug 2017 17:01:33 +0200 Message-Id: <20170823150143.2746796-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:Siu8aNI2mU2shDWxGqTf+GjGzcAugrXmQ4WNko1N8EzFAdX7Lhu k2/jOjKfbuRe9Hs5NcS5L2dJwhJCprbFGL6zXQmQ7IlFVtu358TZMBBhTnAFGMKSjXyLTdB Pnm0RPjRIQkLZ9JozuW3rzvozMw/aeEUHBh/hJ/JG+TAW+cMZFjycqhyksyQ3sWGOG+WXPd ruGYwjpExV4Ofd2bNhuFw== X-UI-Out-Filterresults: notjunk:1;V01:K0:5hc3q90zGnU=:n7h5M9HEJM3Z4D9SLCJrp0 VmJnP1jPOSA+kKKGt95zGxXRffNKHZK1eResK3UL3lF1GQAESXU1g8r+sTeKCE4a2Zb8KzL8U ZwFatxU9lnaDhJW+1c+BEqmBngmn0g3ElMQyaVMrdXlvUniXTwLZQHQb6gzFsMAgkIhhfXcZA GDaRtWijGQelk9k8sWnv7aA+4zcYdwQg/yMGpRCr8zW1775Tfdvz5JwOSMsV+zJoj3EaHOf76 RKhJt20NWWQlaliJMUE5JOuFcjt9y+fu3NijhkyP2Onl0Hr3N00qDguQ+6sUmlQxUiNDnHjeC Qq05evo1JpuwpSqARtXkE9VetCyZnZc7mG7+dSXLtBi4+BZhoJCEkEGXShvurfXS2oUKIkBCF 61nIC1M1KeUdPEKgki36cQJ5zF4VaKRs2mIzqCeBigY4Xp2jDkPnCXYO4L16ofqRV5TVqfJaB N0faOPdBWoHfm+92/FBBphkbNGgFQW5LevD90MgFmt4zVn0FGm6Zp6T5avLhWo7C5szP0ez/f pRpjwtc89y5nrlEvsVWB2Luof3po+PZ7+/trEa93SKPbj4uQwE5ePN7e52ccTeec6dpt5c/p7 opkevkZp7NuOr+r4q7Zcip2xzHgVr+TTvJ06nen/br/45dTAY0OExDrY7QoD60ywgURljCf5r koOoQXk2wBITmoK/m0PdaKIwuj9XkRygGVg+HnXbzUQrhO2vEmiUwGC3y/xiB81KJd/9AxQDl 5GwGfHZdN9DKpLFkqUtP9dRcx6nGto02JLDMnQ== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1579 Lines: 43 This is an interesting regression with gcc-8, showing a harmless warning for correct code: In file included from include/linux/kernel.h:13:0, ... from drivers/scsi/lpfc/lpfc_debugfs.c:23: include/linux/printk.h:301:2: error: 'eq' may be used uninitialized in this function [-Werror=maybe-uninitialized] printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) ^~~~~~ In file included from drivers/scsi/lpfc/lpfc_debugfs.c:58:0: drivers/scsi/lpfc/lpfc_debugfs.h:451:31: note: 'eq' was declared here I tried to come up with a reduced test case for gcc here a few times, but every time ended up with code that is actually wrong with older gcc versions missing the bug and gcc-8 finding it. As this is the only false-positive -Wmaybe-uninitialized warnign I got with gcc-8 randconfig builds, I'd suggest we work around it. Making the index variable 'unsigned' is enough to shut up the warning, as gcc can then see that comparing eqidx to phba->io_channel_irqs is fine here. Signed-off-by: Arnd Bergmann --- drivers/scsi/lpfc/lpfc_debugfs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/lpfc/lpfc_debugfs.h b/drivers/scsi/lpfc/lpfc_debugfs.h index 7b7d314af0e0..7b7f53a37fd8 100644 --- a/drivers/scsi/lpfc/lpfc_debugfs.h +++ b/drivers/scsi/lpfc/lpfc_debugfs.h @@ -450,7 +450,7 @@ lpfc_debug_dump_cq(struct lpfc_hba *phba, int qtype, int wqidx) { struct lpfc_queue *wq, *cq, *eq; char *qtypestr; - int eqidx; + unsigned int eqidx; /* fcp/nvme wq and cq are 1:1, thus same indexes */ -- 2.9.0