aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Brown <broonie@linaro.org>2013-07-10 10:05:40 -0400
committerMark Brown <broonie@linaro.org>2013-07-15 06:34:51 -0400
commit24a0013a04e81e95198daab98edf4df02e191568 (patch)
tree29a38cf235195f69ef09453ec440c6045627f47a
parenta2fd4f9fa3b9f051550b36c4dfa74bc32bda24ee (diff)
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>
-rw-r--r--drivers/spi/spi.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index a52f16685d6a..c2899161ccac 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -1351,6 +1351,11 @@ static int __spi_async(struct spi_device *spi, struct spi_message *message)
1351 struct spi_master *master = spi->master; 1351 struct spi_master *master = spi->master;
1352 struct spi_transfer *xfer; 1352 struct spi_transfer *xfer;
1353 1353
1354 if (list_empty(&message->transfers))
1355 return -EINVAL;
1356 if (!message->complete)
1357 return -EINVAL;
1358
1354 /* Half-duplex links include original MicroWire, and ones with 1359 /* Half-duplex links include original MicroWire, and ones with
1355 * only one data pin like SPI_3WIRE (switches direction) or where 1360 * only one data pin like SPI_3WIRE (switches direction) or where
1356 * either MOSI or MISO is missing. They can also be caused by 1361 * either MOSI or MISO is missing. They can also be caused by