From: swarren@wwwdotorg.org (Stephen Warren)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] spi: sirf: avoid uninitialized-use warning
Date: Mon, 03 Jun 2013 09:44:42 -0600 [thread overview]
Message-ID: <51ACB9EA.2030807@wwwdotorg.org> (raw)
In-Reply-To: <2423840.pM7qIRtGlE@wuerfel>
On 06/03/2013 07:24 AM, Arnd Bergmann wrote:
> 24778be20 "spi: convert drivers to use bits_per_word_mask"
> removed the "default" statement in the spi_sirfsoc_setup_transfer
> switch, causing a new warning:
>
> drivers/spi/spi-sirf.c: In function 'spi_sirfsoc_setup_transfer':
> arch/arm/include/asm/io.h:90:2: warning: 'rxfifo_ctrl' may be used uninitialized in this function [-Wmaybe-uninitialized]
> asm volatile("str %1, %0"
> ^
> drivers/spi/spi-sirf.c:364:19: note: 'rxfifo_ctrl' was declared here
> u32 txfifo_ctrl, rxfifo_ctrl;
> ^
>
> The compiler has correctly identified that this case may happen,
> but since we know that things are horribly broken if bits_per_word
> is ever something other than the values we tested, calling BUG()
> is an appropriate action and tells the compiler that execution
> will not continue afterwards.
I guess this is fine, although BUG() seems a little scary, even though
it is a bug.
In some of the other drivers, I converted:
if () {
} else if () {
} else {
error
}
... to:
if () {
} else {
}
... the equivalent of which would be to just add a "default:" to, say,
the 8-bpw case in the switch. But I guess I don't feel too strongly
either way.
prev parent reply other threads:[~2013-06-03 15:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-03 13:24 [PATCH] spi: sirf: avoid uninitialized-use warning Arnd Bergmann
2013-06-03 15:44 ` Stephen Warren [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=51ACB9EA.2030807@wwwdotorg.org \
--to=swarren@wwwdotorg.org \
--cc=linux-arm-kernel@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.