summaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi_bfin5xx.c
diff options
context:
space:
mode:
authorBob Liu <lliubbo@gmail.com>2010-09-17 03:46:22 +0000
committerMike Frysinger <vapier@gentoo.org>2010-10-18 02:49:43 -0400
commit2e768659df35ea337cb57ea3573c918d31e07894 (patch)
tree3076e57dd4b733ed31da18c6b8c5c74eb518f5c1 /drivers/spi/spi_bfin5xx.c
parent4190f6a51f3f9c7c8298202d31b3ead9381c33f1 (diff)
downloadop-kernel-dev-2e768659df35ea337cb57ea3573c918d31e07894.zip
op-kernel-dev-2e768659df35ea337cb57ea3573c918d31e07894.tar.gz
spi/bfin_spi: check per-transfer bits_per_word
Currently, if the bits_per_word when doing a transfer is not 8bits, we always treat it as 16bits when we should actually be returning an error. Signed-off-by: Bob Liu <lliubbo@gmail.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'drivers/spi/spi_bfin5xx.c')
-rw-r--r--drivers/spi/spi_bfin5xx.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c
index 21de860..bd18214 100644
--- a/drivers/spi/spi_bfin5xx.c
+++ b/drivers/spi/spi_bfin5xx.c
@@ -644,11 +644,16 @@ static void bfin_spi_pump_transfers(unsigned long data)
drv_data->len = transfer->len;
cr_width = 0;
drv_data->ops = &bfin_transfer_ops_u8;
- } else {
+ } else if (bits_per_word == 16) {
drv_data->n_bytes = 2;
drv_data->len = (transfer->len) >> 1;
cr_width = BIT_CTL_WORDSIZE;
drv_data->ops = &bfin_transfer_ops_u16;
+ } else {
+ dev_err(&drv_data->pdev->dev, "transfer: unsupported bits_per_word\n");
+ message->status = -EINVAL;
+ bfin_spi_giveback(drv_data);
+ return;
}
cr = read_CTRL(drv_data) & ~(BIT_CTL_TIMOD | BIT_CTL_WORDSIZE);
cr |= cr_width;
OpenPOWER on IntegriCloud