From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 1180D1BAD7; Thu, 21 Jun 2018 19:15:13 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Jun 2018 10:15:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,252,1526367600"; d="scan'208";a="49527459" Received: from silpixa00399752.ir.intel.com (HELO silpixa00399752.ger.corp.intel.com) ([10.237.222.212]) by fmsmga008.fm.intel.com with ESMTP; 21 Jun 2018 10:15:12 -0700 From: Ferruh Yigit To: Jerin Jacob , Maciej Czekaj Cc: dev@dpdk.org, Ferruh Yigit , stable@dpdk.org Date: Thu, 21 Jun 2018 19:14:50 +0100 Message-Id: <20180621181450.91425-1-ferruh.yigit@intel.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] net/thunderx: fix build with gcc optimization on X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2018 17:15:15 -0000 build error gcc version 6.3.1 20161221 (Red Hat 6.3.1-1), with EXTRA_CFLAGS="-O3": .../drivers/net/thunderx/nicvf_ethdev.c:907:9: error: ‘txq’ may be used uninitialized in this function [-Werror=maybe-uninitialized] if (txq->pool_free == nicvf_single_pool_free_xmited_buffers) ~~~^~~~~~~~~~~ .../drivers/net/thunderx/nicvf_ethdev.c:886:20: note: ‘txq’ was declared here struct nicvf_txq *txq; ^~~ Same error on function 'nicvf_eth_dev_init' and 'nicvf_dev_start', it seems 'nicvf_set_tx_function' inlined when optimization enabled. Initialize the txq and add NULL check before using it to fix. Fixes: 7413feee662d ("net/thunderx: add device start/stop and close") Cc: stable@dpdk.org Reported-by: Richard Walsh Signed-off-by: Ferruh Yigit --- Btw, no compiler optimization enabled, only nicvf_rxtx.c has -Ofast, is this intentional? --- drivers/net/thunderx/nicvf_ethdev.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c index 99fcd516b..4ab1bfbe6 100644 --- a/drivers/net/thunderx/nicvf_ethdev.c +++ b/drivers/net/thunderx/nicvf_ethdev.c @@ -883,7 +883,7 @@ nicvf_dev_tx_queue_release(void *sq) static void nicvf_set_tx_function(struct rte_eth_dev *dev) { - struct nicvf_txq *txq; + struct nicvf_txq *txq = NULL; size_t i; bool multiseg = false; @@ -904,6 +904,9 @@ nicvf_set_tx_function(struct rte_eth_dev *dev) dev->tx_pkt_burst = nicvf_xmit_pkts; } + if (!txq) + return; + if (txq->pool_free == nicvf_single_pool_free_xmited_buffers) PMD_DRV_LOG(DEBUG, "Using single-mempool tx free method"); else -- 2.17.1