diff options
author | Atsushi Nemoto <anemo@mba.ocn.ne.jp> | 2014-02-28 23:03:16 +0900 |
---|---|---|
committer | Nitin Garg <nitin.garg@freescale.com> | 2015-09-17 09:20:37 -0500 |
commit | 03c150fa6b07c5357115b795f53f53820404dda2 (patch) | |
tree | e30545ff673f1f0671f942d51a26f4a6562e764f /drivers/spi/spi.c | |
parent | a8a2cc9f6f52e5776721d538bd8a61ed1c8772a2 (diff) |
spi: core: make zero length transfer valid again
Zero length transfer becomes invalid since
"spi: core: Validate length of the transfers in message" commit,
but it should be valid to support an odd device, for example, which
requires long delay between chipselect and the first transfer, etc.
Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Tested-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 6ea312936d68b557766dafa9a3c4617e14ffa076)
(cherry picked from commit 2e6324d5d3d41454776a6be0b369c758448242ea)
Diffstat (limited to 'drivers/spi/spi.c')
-rw-r--r-- | drivers/spi/spi.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index acf7e238449b..8328d21a40da 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -1824,7 +1824,7 @@ static int __spi_validate(struct spi_device *spi, struct spi_message *message) { struct spi_master *master = spi->master; struct spi_transfer *xfer; - int w_size, n_words; + int w_size; if (list_empty(&message->transfers)) return -EINVAL; @@ -1887,9 +1887,8 @@ static int __spi_validate(struct spi_device *spi, struct spi_message *message) else w_size = 4; - n_words = xfer->len / w_size; /* No partial transfers accepted */ - if (!n_words || xfer->len % w_size) + if (xfer->len % w_size) return -EINVAL; if (xfer->speed_hz && master->min_speed_hz && |