Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp978603pxb; Wed, 3 Mar 2021 23:17:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJw+owTesma9rnpLkGXAoyufn7Eo+4YHD1VjolAIBSI4Yl4Lgfm/C8NLA7MIV50VYDRW+CRw X-Received: by 2002:a05:6402:95b:: with SMTP id h27mr2850710edz.93.1614842229686; Wed, 03 Mar 2021 23:17:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614842229; cv=none; d=google.com; s=arc-20160816; b=TLYBcmDDXohM/O1VCo5rk7d0fgAC5A8oDuvcRV90v5IcZ44iXluUeU+N7zRk/oJNgr genmy+1wXMdZacyaYNglSVZwLF83mLHWnQcf/MG3VAPGNHOLE8Pteesml45rq1tRx3o0 6FDRz53jxuI9NMCayf8oSI8cwvEc1q+Mcp4V848E0n+uxdh2nSskMKKb/O9O3hX20gv8 80lHnLY/aC1eY9IamLnVBvV1+O8XDG3lxsZWLVd+VaP7XxXRUlncojgZDvsKMigMc6Tx 1o2ljPq0YiED9v54X5KSShF57z3VO+Ptpw7pH7EUq5pehkoWa1K9EI9UyakXnMp2q4Rz uukg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=F3QlV95Dyacci5DNH8ESkLtQtYhsLvxatgwWLG7XrnE=; b=VZeugJ2FkaLLjABx3QLFecAK7IzqM3LBQnFaoVxDkItYb8zycMSPzSXrBGQUfobelk ofZas79Xxv7utoELg2pElKzPPOAoi+Hagzb47rCDal56D+Qf6s+h7nuVUw4FELbl+Mzd I2nn8RYOl7ReVVCFDLuA1+vEojzNYOtqm+carBMuLej0rQoTJLtufy/cKzro0ZpbXH/j 7FaQ2tWeiXEKsd07H6rfCV/p7vdEmt4mvIvuQ4B8jFsLTgWFR/LDZD/X7+DVrSG9os/I bv4MFJoeXVOyk5qlVJvXhbKXy6gBh/rmGt/PWFVBTPEooe4YCrwnXGR3Z8wVRyIj49ap Capg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o11si17129184eju.241.2021.03.03.23.16.47; Wed, 03 Mar 2021 23:17:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1840097AbhCBWPu (ORCPT + 99 others); Tue, 2 Mar 2021 17:15:50 -0500 Received: from mx2.suse.de ([195.135.220.15]:51440 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349042AbhCBUER (ORCPT ); Tue, 2 Mar 2021 15:04:17 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id A79D8AC24; Tue, 2 Mar 2021 19:48:02 +0000 (UTC) From: Michal Suchanek To: netdev@vger.kernel.org Cc: Michal Suchanek , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Dany Madden , Lijun Pan , Sukadev Bhattiprolu , "David S. Miller" , Jakub Kicinski , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH] ibmvnic: Fix possibly uninitialized old_num_tx_queues variable warning. Date: Tue, 2 Mar 2021 20:47:47 +0100 Message-Id: <20210302194747.21704-1-msuchanek@suse.de> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org GCC 7.5 reports: ../drivers/net/ethernet/ibm/ibmvnic.c: In function 'ibmvnic_reset_init': ../drivers/net/ethernet/ibm/ibmvnic.c:5373:51: warning: 'old_num_tx_queues' may be used uninitialized in this function [-Wmaybe-uninitialized] ../drivers/net/ethernet/ibm/ibmvnic.c:5373:6: warning: 'old_num_rx_queues' may be used uninitialized in this function [-Wmaybe-uninitialized] The variable is initialized only if(reset) and used only if(reset && something) so this is a false positive. However, there is no reason to not initialize the variables unconditionally avoiding the warning. Fixes: 635e442f4a48 ("ibmvnic: merge ibmvnic_reset_init and ibmvnic_init") Signed-off-by: Michal Suchanek --- drivers/net/ethernet/ibm/ibmvnic.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c index 118a4bd3f877..3bad762083c5 100644 --- a/drivers/net/ethernet/ibm/ibmvnic.c +++ b/drivers/net/ethernet/ibm/ibmvnic.c @@ -5219,16 +5219,14 @@ static int ibmvnic_reset_init(struct ibmvnic_adapter *adapter, bool reset) { struct device *dev = &adapter->vdev->dev; unsigned long timeout = msecs_to_jiffies(20000); - u64 old_num_rx_queues, old_num_tx_queues; + u64 old_num_rx_queues = adapter->req_rx_queues; + u64 old_num_tx_queues = adapter->req_tx_queues; int rc; adapter->from_passive_init = false; - if (reset) { - old_num_rx_queues = adapter->req_rx_queues; - old_num_tx_queues = adapter->req_tx_queues; + if (reset) reinit_completion(&adapter->init_done); - } adapter->init_done_rc = 0; rc = ibmvnic_send_crq_init(adapter); -- 2.26.2