From: Kalle Valo <kvalo@codeaurora.org>
To: Arnd Bergmann <arnd@arndb.de>
Cc: "David S. Miller" <davem@davemloft.net>,
Larry Finger <Larry.Finger@lwfinger.net>,
Arnd Bergmann <arnd@arndb.de>, Priit Laes <plaes@plaes.org>,
clang-built-linux@googlegroups.com,
Nick Desaulniers <ndesaulniers@google.com>,
Nathan Chancellor <natechancellor@gmail.com>,
linux-wireless@vger.kernel.org, b43-dev@lists.infradead.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] b43: shut up clang -Wuninitialized variable warning
Date: Thu, 4 Apr 2019 10:14:22 +0000 (UTC) [thread overview]
Message-ID: <20190404101423.7C6CF61C62@smtp.codeaurora.org> (raw)
In-Reply-To: <20190322143725.1332353-1-arnd@arndb.de>
Arnd Bergmann <arnd@arndb.de> wrote:
> Clang warns about what is clearly a case of passing an uninitalized
> variable into a static function:
>
> drivers/net/wireless/broadcom/b43/phy_lp.c:1852:23: error: variable 'gains' is uninitialized when used here
> [-Werror,-Wuninitialized]
> lpphy_papd_cal(dev, gains, 0, 1, 30);
> ^~~~~
> drivers/net/wireless/broadcom/b43/phy_lp.c:1838:2: note: variable 'gains' is declared here
> struct lpphy_tx_gains gains, oldgains;
> ^
> 1 error generated.
>
> However, this function is empty, and its arguments are never evaluated,
> so gcc in contrast does not warn here. Both compilers behave in a
> reasonable way as far as I can tell, so we should change the code
> to avoid the warning everywhere.
>
> We could just eliminate the lpphy_papd_cal() function entirely,
> given that it has had the TODO comment in it for 10 years now
> and is rather unlikely to ever get done. I'm doing a simpler
> change here, and just pass the 'oldgains' variable in that has
> been initialized, based on the guess that this is what was
> originally meant.
>
> Fixes: 2c0d6100da3e ("b43: LP-PHY: Begin implementing calibration & software RFKILL support")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
> Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
Patch applied to wireless-drivers-next.git, thanks.
d825db346270 b43: shut up clang -Wuninitialized variable warning
--
https://patchwork.kernel.org/patch/10865933/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
prev parent reply other threads:[~2019-04-04 10:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-22 14:37 [PATCH] b43: shut up clang -Wuninitialized variable warning Arnd Bergmann
2019-03-22 15:47 ` Larry Finger
2019-03-22 16:06 ` Nathan Chancellor
2019-04-04 10:14 ` Kalle Valo [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=20190404101423.7C6CF61C62@smtp.codeaurora.org \
--to=kvalo@codeaurora.org \
--cc=Larry.Finger@lwfinger.net \
--cc=arnd@arndb.de \
--cc=b43-dev@lists.infradead.org \
--cc=clang-built-linux@googlegroups.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=natechancellor@gmail.com \
--cc=ndesaulniers@google.com \
--cc=netdev@vger.kernel.org \
--cc=plaes@plaes.org \
/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).