diff mbox

[4/6] spi: spi-s3c64xx: Do not ignore timeout errors in polling I/O mode

Message ID 20180416154021.25626-4-s.nawrocki@samsung.com (mailing list archive)
State New, archived
Headers show

Commit Message

Currently timeout errors in polling I/O mode transfer are silently ignored.
Fix it by returning an error when we time out waiting on the RX FIFO level
to reach the transfer length.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
---
 drivers/spi/spi-s3c64xx.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Andi Shyti April 16, 2018, 7:12 p.m. UTC | #1
Hi Sylwester,

On 17.04.2018 00:40, Sylwester Nawrocki wrote:
> Currently timeout errors in polling I/O mode transfer are silently 
> ignored.
> Fix it by returning an error when we time out waiting on the RX FIFO 
> level
> to reach the transfer length.

yes, makes sense.

> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>

Reviewed-by: Andi Shyti <andi@etezian.org>

Thanks,
Andi
Krzysztof Kozlowski April 17, 2018, 6:30 a.m. UTC | #2
On Mon, Apr 16, 2018 at 5:40 PM, Sylwester Nawrocki
<s.nawrocki@samsung.com> wrote:
> Currently timeout errors in polling I/O mode transfer are silently ignored.
> Fix it by returning an error when we time out waiting on the RX FIFO level
> to reach the transfer length.
>
> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
> ---
>  drivers/spi/spi-s3c64xx.c | 2 ++
>  1 file changed, 2 insertions(+)
>

Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>

Best regards,
Krzysztof
Mark Brown April 17, 2018, 10:02 a.m. UTC | #3
On Mon, Apr 16, 2018 at 05:40:19PM +0200, Sylwester Nawrocki wrote:
> Currently timeout errors in polling I/O mode transfer are silently ignored.
> Fix it by returning an error when we time out waiting on the RX FIFO level
> to reach the transfer length.

This would probably have been better sent as a fix before the cosmetic
updates.
diff mbox

Patch

diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index e90e60bc1ecc..d87fa7d9fad3 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -502,6 +502,8 @@  static int wait_for_pio(struct s3c64xx_spi_driver_data *sdd,
 		status = readl(regs + S3C64XX_SPI_STATUS);
 	} while (RX_FIFO_LVL(status, sdd) < xfer->len && --val);
 
+	if (!val)
+		return -EIO;
 
 	/* If it was only Tx */
 	if (!xfer->rx_buf) {