From patchwork Thu Aug 24 23:10:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 110966 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp134611qge; Thu, 24 Aug 2017 16:11:47 -0700 (PDT) X-Received: by 10.98.194.155 with SMTP id w27mr7902697pfk.246.1503616307322; Thu, 24 Aug 2017 16:11:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503616307; cv=none; d=google.com; s=arc-20160816; b=eckpTfdeH1wUwnfK3HFH11J1O7I7TsnO+15KQdP3bxBjBeAInbJV0CuJpp+vDD0i8e 4CNpa7Ne2bvjuxOg+P9uoa+6pZm3As/3L6f7CsJB7MSQk5R3rOEqtXgAtuVHx1w8FK5j CeKlX8opO4eWvHFjXpc4msQQSFl83CjLQk92HhD8mZBdvdzeA83mFAPuDFVPyJ9Yl3Jj W3g6hsOTz2XzxaB3NyGW2XFA8gnVJfHqC1HMy4XQywEW5X5TZGEkgxR4jFJGGKZ8drWL fYl30TXlsq46SG7HKIuedTv1/E5DuGFcfK50t+jrYkcp+9qVtAhx6fshrdKPs5oiztfF PLlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=nPnEeD/qsIbBAj7N71feErIhYhnGjC5iz7BbKpT+YAA=; b=lfqCTn3/bt2Os6jqE8y3m447xMMtD0suuzK9UhugPXBg5hUaaln0mQ60CsdgpOphZP 6ax3NDBBA31y0PgVzVuL0VQB/SpRKssmwqQa42jMvZsPRVLUh5dkU83mg6EPS0Ku/J+z tfp/TdMO6W85Y4AQGdPX2YJoRaaDVwn+wQCum4A6Sd/VP6MZYQbTb53v4Jvr9lxubUS5 qxjJ1pq3RfjiDMwT1FswVD/RQSB9q7IvpdA/iT0c4WuabX/5Xk3w6vAogZzmzIwk2PrV pLiLsNGu9r7TgyMMiIZ4DnZ94egRh5fLZzcg+u8yv4Y3E7k1ydZFk1Gxnf3Wn/rNTkAV ZwMw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h2si3541411pfc.518.2017.08.24.16.11.46; Thu, 24 Aug 2017 16:11:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754090AbdHXXLo (ORCPT + 26 others); Thu, 24 Aug 2017 19:11:44 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:63052 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753411AbdHXXLn (ORCPT ); Thu, 24 Aug 2017 19:11:43 -0400 Received: from wuerfel.lan ([95.208.190.237]) by mrelayeu.kundenserver.de (mreue005 [212.227.15.129]) with ESMTPA (Nemesis) id 0MaG7g-1e0LCG3VBw-00Ju7V; Fri, 25 Aug 2017 01:10:28 +0200 From: Arnd Bergmann To: James Smart , Dick Kennedy , "James E.J. Bottomley" , "Martin K. Petersen" Cc: Arnd Bergmann , Hannes Reinecke , Johannes Thumshirn , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 2/2] scsi: lpfc: avoid false-positive gcc-8 warning Date: Fri, 25 Aug 2017 01:10:00 +0200 Message-Id: <20170824231016.1843118-2-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170824231016.1843118-1-arnd@arndb.de> References: <20170824231016.1843118-1-arnd@arndb.de> X-Provags-ID: V03:K0:rThUZ54Et99rKtlz/vDulbjODT2xuY2pnL5UetgvTm1r0abUWhe COZBsMxsr9qM0/vO6CGivvClZ7bTKIz9eVvs/HbZXSvayx6jvPLoB7yXkqAL3SNyyCjfJI0 cFnTPHT9+/oNjyBeber3X8MfzYtaGTLe2bZLBu8P3o+EzkHyYVyp7xlNlMdr4FwUaCIDxHw D3HPAwSSzpHPgXTabeIcw== X-UI-Out-Filterresults: notjunk:1; V01:K0:5ZkjGTjIebI=:g998s0mq2azb+oLb1chRni W1ckrzT8iGLuA/OjUKQIofuplUrMW0gW0+/21PuQKrbQLWM/9ogaTf82Dmem9jHBLYJ8w3jqD W8lIf1g0NUXGH22biQU7qi3nmmacYESfEb37AwvxzCEWIHFKmkHlrDK/phA5bJHwultCMum7d TgsGEIqwJAjc1bXDS+BxyF6/D0oUR2qIirJvdCr7bRaj5/ert1XMC4/F39BANe1HM1vHNb/H0 yhLDS+YhgqEY4tAgY2pXr8S2joAAGckG8URx1jE5o3zAUxizFseh1D7xj7a7UJXU2+qxtNBmZ pKWQIg7SoZSYrhsgzoeCKOS/CUS6GZIk3vE4UiDpw6pDW19QOBRLSoqBmKyOJGzXdmwKwdsTr k8y7/wpAiH7vjNfOetcVbFXCX3QgZn5X2CJ+mJf1hgADL84/v/In548vnfl9xiWVZEsJLj2ub k3N32PSq3abORUYxojew0a7JRiJ6bCjYVmedmQ17qvKpWMWwEpuskCqDWl+wCYzI0nZcKGVjj sW0WMDmYTHcvT/fSRa0IBKXF46gEm4SMO2uDrkvcjaKPAGZ5JnhqiBdBzQPDRSx6p5zRArAaR lo0oJ821nOvw1Ko3eKWFAgJnymTZoxRQikjX4w6I/nwhLJRoTsBEdKLeSdyCt0N0v2VGmDeB/ bZJsvhAyI05G0abnf+PEGqHqJhW6kbtZwXQ3UFsOSYz75KdGpUnrJhxIUlVWfyILZkUy03iFG cjwE+0UcwfDfun3AeCkOLSiECU4/Dfg3NXUY+g== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 managed to reduce the warning into a small test case for gcc-8 that I reported in the gcc bugzilla[1]. As a workaround, this changes the logic to move the two assignments of 'eq' out of the conditions and instead make the index conditional. This works for all configurations I tried and avoids adding a bogus initialization. Acked-by: James Smart Link: [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81958 Signed-off-by: Arnd Bergmann --- drivers/scsi/lpfc/lpfc_debugfs.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 2.9.0 diff --git a/drivers/scsi/lpfc/lpfc_debugfs.h b/drivers/scsi/lpfc/lpfc_debugfs.h index 7b7d314af0e0..c4edd87bfc65 100644 --- a/drivers/scsi/lpfc/lpfc_debugfs.h +++ b/drivers/scsi/lpfc/lpfc_debugfs.h @@ -478,16 +478,16 @@ lpfc_debug_dump_cq(struct lpfc_hba *phba, int qtype, int wqidx) return; for (eqidx = 0; eqidx < phba->io_channel_irqs; eqidx++) { - eq = phba->sli4_hba.hba_eq[eqidx]; - if (cq->assoc_qid == eq->queue_id) + if (cq->assoc_qid == phba->sli4_hba.hba_eq[eqidx]->queue_id) break; } if (eqidx == phba->io_channel_irqs) { pr_err("Couldn't find EQ for CQ. Using EQ[0]\n"); eqidx = 0; - eq = phba->sli4_hba.hba_eq[0]; } + eq = phba->sli4_hba.hba_eq[eqidx]; + if (qtype == DUMP_FCP || qtype == DUMP_NVME) pr_err("%s CQ: WQ[Idx:%d|Qid%d]->CQ[Idx%d|Qid%d]" "->EQ[Idx:%d|Qid:%d]:\n",