summaryrefslogtreecommitdiff
path: root/drivers/spi
diff options
context:
space:
mode:
authorSifan Naeem <sifan.naeem@imgtec.com>2015-07-27 13:11:15 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-09-21 10:05:35 -0700
commitb82ed8c90e5f1ad73d1c355c58ef38a789a16c7d (patch)
tree1b04a8b04be99db985170b688fa71f819d82e113 /drivers/spi
parent49b85054a83dd407879206f43fd6944287848189 (diff)
downloadlwn-b82ed8c90e5f1ad73d1c355c58ef38a789a16c7d.tar.gz
lwn-b82ed8c90e5f1ad73d1c355c58ef38a789a16c7d.zip
spi: img-spfi: check for timeout error before proceeding
commit 011710e2ab659c7ad6e5e554806414bd7a9508be upstream. Calling spfi_wait_all_done is not required if the transfer has timed out before all data is transferred. spfi_wait_all_done polls for Alldone interrupt which is triggered to mark the transfer as complete and to indicate it is now safe to issue a new transfer. Fixes: 8c2c8c0 ("spi: img-spfi: Control CS lines with GPIO") Signed-off-by: Sifan Naeem <sifan.naeem@imgtec.com> Reviewed-by: Andrew Bresticker <abrestic@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/spi-img-spfi.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/spi/spi-img-spfi.c b/drivers/spi/spi-img-spfi.c
index acce90ac7371..9fed29960332 100644
--- a/drivers/spi/spi-img-spfi.c
+++ b/drivers/spi/spi-img-spfi.c
@@ -267,15 +267,15 @@ static int img_spfi_start_pio(struct spi_master *master,
cpu_relax();
}
- ret = spfi_wait_all_done(spfi);
- if (ret < 0)
- return ret;
-
if (rx_bytes > 0 || tx_bytes > 0) {
dev_err(spfi->dev, "PIO transfer timed out\n");
return -ETIMEDOUT;
}
+ ret = spfi_wait_all_done(spfi);
+ if (ret < 0)
+ return ret;
+
return 0;
}