Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp250938ybi; Wed, 29 May 2019 20:39:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqzykLHhQFXc9EfGVW/a+ROqllHcLjDhHCpzHafdLy9chuLAqLSz82LWV+s055Za66lsGLbV X-Received: by 2002:a62:d41c:: with SMTP id a28mr1564992pfh.31.1559187589405; Wed, 29 May 2019 20:39:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559187589; cv=none; d=google.com; s=arc-20160816; b=bifhgy9sL+Crzi2bQfTH0gJwNQNCXQOWf1ME3fAoydY7FGhZ4cWaRCDdjbd3EvcYVS T2oypKOUBv2C5+ll11CoIJ4r4REBxWSRNSzJa0gTRch8SZYq3h+JNVmE1iuDcQMTQPQ8 /me8kLW4SFLYskvIGJsaq1UNkiGfh1SyEha58qDuyOmYpdNY3Z4DT2XWIyCr/hf+X7k8 IF5NkkXUkamF7hNf9CZ9W2yYn5mM9SZOuHebKvw5WCtEZCw/aG6Rmb2kE5/nXIRsJgqU 59SfPxiq/3RrIbTTUQ/inEcKSLlJqgJujkf0F3BdInh2kIWyoeqPKLYXr594BWlWNT56 +rQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GNIC0Uegbia+ZlDymmq0YGv09OR+axcX5M3jXr+7CN0=; b=rPk4I+Lrn0PgGIdecrnl5w8Kyn/gqROFrY1qr61XEMLSQnfg3pWA9KfkXzj05YTsBD PXIC6tpszboCRfVRi1wPFGdIpk99SCmhokYjM4ueKZbA7G+KrRqBY6kYJ6Mzqo6DZjPW 9aGE1+nAMeKJ0pjwFqmXNWGv+KKuTtDHWW6MbSkMSUWhazyH6vL+hTMYsm+POs7oaKDs ACBgnGUBdLtB76lsNUDxTbgVhb5OaiuWDJh1YbsqNNvWMZJVHyTR6oAnn5rnLfyJld+k t8cvA/BshmOCiW/24S6x3Jj5tP82iWD5s1fWo+e5ZSpzWRvr7oGYbkc7wjU/wm45WevN oNdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=i4grOyIO; 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 l1si2019017pgi.278.2019.05.29.20.39.32; Wed, 29 May 2019 20:39:49 -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; dkim=pass header.i=@kernel.org header.s=default header.b=i4grOyIO; 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 S1733268AbfE3DYY (ORCPT + 99 others); Wed, 29 May 2019 23:24:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:49208 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731405AbfE3DSE (ORCPT ); Wed, 29 May 2019 23:18:04 -0400 Received: from localhost (ip67-88-213-2.z213-88-67.customer.algx.net [67.88.213.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B72C12475D; Thu, 30 May 2019 03:18:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559186283; bh=uJWCgcHIYbc4SdYfmmV2gAJQm/i9pZikepTpAYBVqCY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i4grOyIOBOiRJo7Pc80MdvusLFa1d93T2atjV+are6CAAHfd7dV+3MZSlKIi1O+Ca 0zZYJc6Y91jhhkcDGpMxoqaTFbWlZf3dsfyt2FxM2lF4It9RdweUumYBFpxjfDGWMJ aJq2ny3V76f9ejoGUavxo14hKM0VvVj8voplxcG0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , James Smart , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 4.19 237/276] scsi: lpfc: avoid uninitialized variable warning Date: Wed, 29 May 2019 20:06:35 -0700 Message-Id: <20190530030539.944220603@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190530030523.133519668@linuxfoundation.org> References: <20190530030523.133519668@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit faf5a744f4f8d76e7c03912b5cd381ac8045f6ec ] clang -Wuninitialized incorrectly sees a variable being used without initialization: drivers/scsi/lpfc/lpfc_nvme.c:2102:37: error: variable 'localport' is uninitialized when used here [-Werror,-Wuninitialized] lport = (struct lpfc_nvme_lport *)localport->private; ^~~~~~~~~ drivers/scsi/lpfc/lpfc_nvme.c:2059:38: note: initialize the variable 'localport' to silence this warning struct nvme_fc_local_port *localport; ^ = NULL 1 error generated. This is clearly in dead code, as the condition leading up to it is always false when CONFIG_NVME_FC is disabled, and the variable is always initialized when nvme_fc_register_localport() got called successfully. Change the preprocessor conditional to the equivalent C construct, which makes the code more readable and gets rid of the warning. Signed-off-by: Arnd Bergmann Acked-by: James Smart Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/lpfc/lpfc_nvme.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_nvme.c b/drivers/scsi/lpfc/lpfc_nvme.c index ca62117a2d131..099f70798fdda 100644 --- a/drivers/scsi/lpfc/lpfc_nvme.c +++ b/drivers/scsi/lpfc/lpfc_nvme.c @@ -2482,15 +2482,15 @@ lpfc_nvme_create_localport(struct lpfc_vport *vport) if (!cstat) return -ENOMEM; + if (!IS_ENABLED(CONFIG_NVME_FC)) + return ret; + /* localport is allocated from the stack, but the registration * call allocates heap memory as well as the private area. */ -#if (IS_ENABLED(CONFIG_NVME_FC)) + ret = nvme_fc_register_localport(&nfcp_info, &lpfc_nvme_template, &vport->phba->pcidev->dev, &localport); -#else - ret = -ENOMEM; -#endif if (!ret) { lpfc_printf_vlog(vport, KERN_INFO, LOG_NVME | LOG_NVME_DISC, "6005 Successfully registered local " -- 2.20.1