1
0
Fork 0

spi: More sanity checks for transfers

Check that transfers are non-empty and that there is a completion for
them.

Signed-off-by: Mark Brown <broonie@linaro.org>
hifive-unleashed-5.1
Mark Brown 2013-07-10 15:05:40 +01:00
parent a2fd4f9fa3
commit 24a0013a04
1 changed files with 5 additions and 0 deletions

View File

@ -1351,6 +1351,11 @@ static int __spi_async(struct spi_device *spi, struct spi_message *message)
struct spi_master *master = spi->master;
struct spi_transfer *xfer;
if (list_empty(&message->transfers))
return -EINVAL;
if (!message->complete)
return -EINVAL;
/* Half-duplex links include original MicroWire, and ones with
* only one data pin like SPI_3WIRE (switches direction) or where
* either MOSI or MISO is missing. They can also be caused by