spi: sirf: avoid uninitialized-use warning
authorArnd Bergmann <arnd@arndb.de>
Mon, 3 Jun 2013 13:24:53 +0000 (15:24 +0200)
committerMark Brown <broonie@linaro.org>
Mon, 3 Jun 2013 14:28:34 +0000 (15:28 +0100)
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.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Stephen Warren <swarren@wwwdotorg.org>
Cc: Mark Brown <broonie@kernel.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
drivers/spi/spi-sirf.c

index 77497be042a8625da04a5da104b9ea6e1a9f4053..e262736f91639b9c02ad7d2f8dd4eaba32d88fbe 100644 (file)
@@ -425,6 +425,8 @@ spi_sirfsoc_setup_transfer(struct spi_device *spi, struct spi_transfer *t)
                rxfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE / 2) |
                                        SIRFSOC_SPI_FIFO_WIDTH_DWORD;
                break;
+       default:
+               BUG();
        }
 
        if (!(spi->mode & SPI_CS_HIGH))