From: David Laight <David.Laight-ZS65k/vG3HxXrIkS9f7CXA@public.gmane.org>
To: 'Arnd Bergmann' <arnd-r2nGTMty4D4@public.gmane.org>,
Solomon Peachy <pizza-pCgMCH4qpMRg9hUCZPvPmw@public.gmane.org>,
Kalle Valo <kvalo-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
Cc: Johannes Berg
<johannes.berg-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
"linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
"netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
"linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: RE: [PATCH] cw1200: fix bogus maybe-uninitialized warning
Date: Tue, 25 Oct 2016 13:24:55 +0000 [thread overview]
Message-ID: <063D6719AE5E284EB5DD2968C1650D6DB0209E9A@AcuExch.aculab.com> (raw)
In-Reply-To: <20161024154215.2863586-1-arnd-r2nGTMty4D4@public.gmane.org>
From: Of Arnd Bergmann
> Sent: 24 October 2016 16:42
> On x86, the cw1200 driver produces a rather silly warning about the
> possible use of the 'ret' variable without an initialization
> presumably after being confused by the architecture specific definition
> of WARN_ON:
>
> drivers/net/wireless/st/cw1200/wsm.c: In function wsm_handle_rx:
> drivers/net/wireless/st/cw1200/wsm.c:1457:9: error: ret may be used uninitialized in this function [-
> Werror=maybe-uninitialized]
>
> As the driver just checks the same variable twice here, we can simplify
> it by removing the second condition, which makes it more readable and
> avoids the warning.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> drivers/net/wireless/st/cw1200/wsm.c | 15 +++++++--------
> 1 file changed, 7 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/net/wireless/st/cw1200/wsm.c b/drivers/net/wireless/st/cw1200/wsm.c
> index 680d60eabc75..094e6637ade2 100644
> --- a/drivers/net/wireless/st/cw1200/wsm.c
> +++ b/drivers/net/wireless/st/cw1200/wsm.c
> @@ -385,14 +385,13 @@ static int wsm_multi_tx_confirm(struct cw1200_common *priv,
> if (WARN_ON(count <= 0))
> return -EINVAL;
>
> - if (count > 1) {
> - /* We already released one buffer, now for the rest */
> - ret = wsm_release_tx_buffer(priv, count - 1);
> - if (ret < 0)
> - return ret;
> - else if (ret > 0)
> - cw1200_bh_wakeup(priv);
> - }
> + /* We already released one buffer, now for the rest */
> + ret = wsm_release_tx_buffer(priv, count - 1);
> + if (ret < 0)
> + return ret;
> +
> + if (ret > 0)
> + cw1200_bh_wakeup(priv);
That doesn't look equivalent to me (when count == 1).
>
> cw1200_debug_txed_multi(priv, count);
> for (i = 0; i < count; ++i) {
Convert this loop into a do ... while so the body executes at least once.
David
next prev parent reply other threads:[~2016-10-25 13:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-24 15:41 [PATCH] cw1200: fix bogus maybe-uninitialized warning Arnd Bergmann
[not found] ` <20161024154215.2863586-1-arnd-r2nGTMty4D4@public.gmane.org>
2016-10-25 13:24 ` David Laight [this message]
2016-10-25 18:13 ` Solomon Peachy
2016-10-25 20:19 ` Arnd Bergmann
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=063D6719AE5E284EB5DD2968C1650D6DB0209E9A@AcuExch.aculab.com \
--to=david.laight-zs65k/vg3hxxriks9f7cxa@public.gmane.org \
--cc=arnd-r2nGTMty4D4@public.gmane.org \
--cc=johannes.berg-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=kvalo-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=pizza-pCgMCH4qpMRg9hUCZPvPmw@public.gmane.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