spi: sirf: replace BUG condition by error code for unsupported transfer
authorQipan Li <Qipan.Li@csr.com>
Mon, 27 Apr 2015 09:22:28 +0000 (09:22 +0000)
committerMark Brown <broonie@kernel.org>
Mon, 27 Apr 2015 19:53:28 +0000 (20:53 +0100)
return error for unsupported bits-per-word format, BUG() is not right
for this scenerios as we are not an ASSERT but an error handler.

Signed-off-by: Qipan Li <Qipan.Li@csr.com>
Signed-off-by: Barry Song <baohua.song@csr.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-sirf.c

index f5715c9f68b0e0cb3dd2f7f568fed38798820796..a50ee9b644ae3f237aedb382ae4e170066ae24df 100644 (file)
@@ -559,7 +559,8 @@ spi_sirfsoc_setup_transfer(struct spi_device *spi, struct spi_transfer *t)
                sspi->tx_word = spi_sirfsoc_tx_word_u32;
                break;
        default:
-               BUG();
+               dev_err(&spi->dev, "bpw %d not supported\n", bits_per_word);
+               return -EINVAL;
        }
 
        sspi->word_width = DIV_ROUND_UP(bits_per_word, 8);