mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-23 17:30:02 +00:00
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>
This commit is contained in:
parent
4190f6a51f
commit
2e768659df
1 changed files with 6 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue