summaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi-davinci.c
diff options
context:
space:
mode:
authorSekhar Nori <nsekhar@ti.com>2015-12-10 17:29:04 +0100
committerMark Brown <broonie@kernel.org>2015-12-12 23:57:44 +0100
commit7f3ac71ac3b05aaa2c55c266448f973188275a8c (patch)
tree549f08faf5ff10d4e237009c37c3ae6027495aea /drivers/spi/spi-davinci.c
parentLinux 4.4-rc1 (diff)
downloadlinux-7f3ac71ac3b05aaa2c55c266448f973188275a8c.tar.xz
linux-7f3ac71ac3b05aaa2c55c266448f973188275a8c.zip
spi: davinci: fix spurious i/o error
davinci_spi_bufs() uses wait_for_completion_interruptible() without bothering to handle -ERESTARTSYS. Due to this, sometime, it returns prematurely when a signal is received. Since the return value is never checked, userspace eventually receives a spurious -EIO. To fix this, use un-interruptible wait_for_completion_timeout(). Signed-off-by: Sekhar Nori <nsekhar@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi/spi-davinci.c')
-rw-r--r--drivers/spi/spi-davinci.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c
index 7d3af3eacf57..57d6960a6252 100644
--- a/drivers/spi/spi-davinci.c
+++ b/drivers/spi/spi-davinci.c
@@ -703,7 +703,8 @@ static int davinci_spi_bufs(struct spi_device *spi, struct spi_transfer *t)
/* Wait for the transfer to complete */
if (spicfg->io_type != SPI_IO_TYPE_POLL) {
- wait_for_completion_interruptible(&(dspi->done));
+ if (wait_for_completion_timeout(&dspi->done, HZ) == 0)
+ errors = SPIFLG_TIMEOUT_MASK;
} else {
while (dspi->rcount > 0 || dspi->wcount > 0) {
errors = davinci_spi_process_events(dspi);