From mboxrd@z Thu Jan 1 00:00:00 1970 From: Adrien Mazarguil Subject: Re: [PATCH v1] net/mlx4: fix missing initializers for old GCC Date: Tue, 24 Oct 2017 16:35:05 +0200 Message-ID: <20171024143505.GB26782@6wind.com> References: <1508848533-180885-1-git-send-email-motih@mellanox.com> <20171024140315.hoyzl5pu625lfcgg@laranjeiro-vm> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Cc: Moti Haimovsky , dev@dpdk.org To: =?utf-8?B?TsOpbGlv?= Laranjeiro Return-path: Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by dpdk.org (Postfix) with ESMTP id 2C6B41B815 for ; Tue, 24 Oct 2017 16:35:18 +0200 (CEST) Received: by mail-wm0-f66.google.com with SMTP id r196so3854827wmf.2 for ; Tue, 24 Oct 2017 07:35:18 -0700 (PDT) Content-Disposition: inline In-Reply-To: <20171024140315.hoyzl5pu625lfcgg@laranjeiro-vm> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi Nelio, On Tue, Oct 24, 2017 at 04:03:15PM +0200, Nélio Laranjeiro wrote: > Hi Moti, > > On Tue, Oct 24, 2017 at 03:35:33PM +0300, Moti Haimovsky wrote: > > This patch works around compilation issues seen on RHEL 7.2 > > using GCC 4.8.5: > > > > [...] In function 'mlx4_rss_init': > > [...]/mlx4_rxq.c:433:19: error: 'wq_num' may be used uninitialized > > in this function [-Werror=maybe-uninitialized] > > > > Fixes: ff3397e90080 ("net/mlx4: relax Rx queue configuration order") > > > > Signed-off-by: Moti Haimovsky > > --- > > drivers/net/mlx4/mlx4_rxq.c | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/drivers/net/mlx4/mlx4_rxq.c b/drivers/net/mlx4/mlx4_rxq.c > > index fb28290..4c50077 100644 > > --- a/drivers/net/mlx4/mlx4_rxq.c > > +++ b/drivers/net/mlx4/mlx4_rxq.c > > @@ -417,6 +417,8 @@ void mlx4_rss_detach(struct mlx4_rss *rss) > > if (wq) { > > wq_num = wq->wq_num; > > claim_zero(ibv_destroy_wq(wq)); > > + } else { > > + wq_num = 0; /* Shut up GCC 4.8 warnings. */ > > } > > claim_zero(ibv_destroy_cq(cq)); > > if (!wq) { > > Why not initialising the wq_num at 0 directly instead of adding this > else branch? Actually that was my suggestion, it is done to highlight the code path where buggy GCC versions choke on what they mistake for an uninitialized variable. Initializing this variable earlier could possibly hide bugs otherwise. Patch is OK for me as is: Acked-by: Adrien Mazarguil -- Adrien Mazarguil 6WIND