From: David Miller <davem@davemloft.net>
To: gthelen@google.com
Cc: ogerlitz@mellanox.com, jackm@dev.mellanox.co.il,
matanb@mellanox.com, idos@mellanox.com, yishaih@mellanox.com,
amirv@mellanox.com, roland@purestorage.com,
netdev@vger.kernel.org, linux-rdma@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net/mlx4: suppress 'may be used uninitialized' warning
Date: Thu, 20 Apr 2017 13:19:49 -0400 (EDT) [thread overview]
Message-ID: <20170420.131949.157388310132608724.davem@davemloft.net> (raw)
In-Reply-To: <20170418062135.76698-1-gthelen@google.com>
From: Greg Thelen <gthelen@google.com>
Date: Mon, 17 Apr 2017 23:21:35 -0700
> gcc 4.8.4 complains that mlx4_SW2HW_MPT_wrapper() uses an uninitialized
> 'mpt' variable:
> drivers/net/ethernet/mellanox/mlx4/resource_tracker.c: In function 'mlx4_SW2HW_MPT_wrapper':
> drivers/net/ethernet/mellanox/mlx4/resource_tracker.c:2802:12: warning: 'mpt' may be used uninitialized in this function [-Wmaybe-uninitialized]
> mpt->mtt = mtt;
>
> I think this warning is a false complaint. mpt is only used when
> mr_res_start_move_to() return zero, and in all such cases it initializes
> mpt. But apparently gcc cannot see that.
>
> Initialize mpt to avoid the warning.
>
> Signed-off-by: Greg Thelen <gthelen@google.com>
Appied to net-next.
prev parent reply other threads:[~2017-04-20 17:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-18 6:21 [PATCH] net/mlx4: suppress 'may be used uninitialized' warning Greg Thelen
2017-04-18 7:02 ` Leon Romanovsky
2017-04-18 7:24 ` Greg Thelen
2017-04-20 17:19 ` David Miller [this message]
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=20170420.131949.157388310132608724.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=amirv@mellanox.com \
--cc=gthelen@google.com \
--cc=idos@mellanox.com \
--cc=jackm@dev.mellanox.co.il \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=matanb@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=ogerlitz@mellanox.com \
--cc=roland@purestorage.com \
--cc=yishaih@mellanox.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).