diff mbox

spi: sirf: replace BUG condition by error code for unsupported transfer

Message ID 1430126548-8171-1-git-send-email-21cnbao@gmail.com (mailing list archive)
State Accepted
Commit f08654a2b582b4e48e8a4a3d2c5c98832adc4387
Headers show

Commit Message

Barry Song April 27, 2015, 9:22 a.m. UTC
From: Qipan Li <Qipan.Li@csr.com>

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>
---
 drivers/spi/spi-sirf.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Mark Brown April 27, 2015, 7:53 p.m. UTC | #1
On Mon, Apr 27, 2015 at 09:22:28AM +0000, Barry Song wrote:
> From: Qipan Li <Qipan.Li@csr.com>
> 
> 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.

Applied, thanks.
diff mbox

Patch

diff --git a/drivers/spi/spi-sirf.c b/drivers/spi/spi-sirf.c
index f5715c9..a50ee9b 100644
--- a/drivers/spi/spi-sirf.c
+++ b/drivers/spi/spi-sirf.c
@@ -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);