cw1200: fix bogus maybe-uninitialized warning
authorArnd Bergmann <arnd@arndb.de>
Tue, 25 Oct 2016 20:21:04 +0000 (22:21 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 25 Feb 2018 10:05:53 +0000 (11:05 +0100)
commitee2f58b4d33710cbbcbc87e078b709320c10b1d9
tree195dfa725b961af2cdd640ddb63e6699f2fb341c
parent445e8f85d87d1a56982c3f9ccdce3faa6e091654
cw1200: fix bogus maybe-uninitialized warning

commit 7fc1503c906f0fac62d3506a6e993e49fb996248 upstream.

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]

We have already checked that 'count' is larger than 0 here, so
we know that 'ret' is initialized. Changing the 'for' loop
into do/while also makes this clear to the compiler.

Suggested-by: David Laight <David.Laight@ACULAB.COM>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/wireless/st/cw1200/wsm.c