DPDK patches and discussions
 help / color / mirror / Atom feed
From: Adrien Mazarguil <adrien.mazarguil@6wind.com>
To: "Nélio Laranjeiro" <nelio.laranjeiro@6wind.com>
Cc: Moti Haimovsky <motih@mellanox.com>, dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH v1] net/mlx4: fix missing initializers for old GCC
Date: Tue, 24 Oct 2017 16:35:05 +0200	[thread overview]
Message-ID: <20171024143505.GB26782@6wind.com> (raw)
In-Reply-To: <20171024140315.hoyzl5pu625lfcgg@laranjeiro-vm>

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 <motih@mellanox.com>
> > ---
> >  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.com>

-- 
Adrien Mazarguil
6WIND

  reply	other threads:[~2017-10-24 14:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-24 12:35 Moti Haimovsky
2017-10-24 14:03 ` Nélio Laranjeiro
2017-10-24 14:35   ` Adrien Mazarguil [this message]
2017-10-24 15:21     ` Nélio Laranjeiro
2017-10-24 18:27     ` Ferruh Yigit
2017-10-24 14:44 ` Adrien Mazarguil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171024143505.GB26782@6wind.com \
    --to=adrien.mazarguil@6wind.com \
    --cc=dev@dpdk.org \
    --cc=motih@mellanox.com \
    --cc=nelio.laranjeiro@6wind.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).