From 306c68aaa7c62010428196d309fda30b6bf57710 Mon Sep 17 00:00:00 2001 From: Roel Kluin Date: Tue, 21 Apr 2009 12:24:46 -0700 Subject: [PATCH] spi: pxa2xx: limit reaches -1 On line 944 the return value of flush() is considered as a boolean, but limit reaches -1 upon timeout which evaluates to true. On 540, 594, 720 the same occurs for wait_ssp_rx_stall() On 536 the same occurs for wait_dma_channel_stop() Signed-off-by: Roel Kluin Acked-by: Eric Miao Cc: David Brownell Cc: Russell King Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/spi/pxa2xx_spi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/spi/pxa2xx_spi.c b/drivers/spi/pxa2xx_spi.c index 1a00b415bcc..885194a0741 100644 --- a/drivers/spi/pxa2xx_spi.c +++ b/drivers/spi/pxa2xx_spi.c @@ -213,7 +213,7 @@ static int flush(struct driver_data *drv_data) while (read_SSSR(reg) & SSSR_RNE) { read_SSDR(reg); } - } while ((read_SSSR(reg) & SSSR_BSY) && limit--); + } while ((read_SSSR(reg) & SSSR_BSY) && --limit); write_SSSR(SSSR_ROR, reg); return limit; @@ -484,7 +484,7 @@ static int wait_ssp_rx_stall(void const __iomem *ioaddr) { unsigned long limit = loops_per_jiffy << 1; - while ((read_SSSR(ioaddr) & SSSR_BSY) && limit--) + while ((read_SSSR(ioaddr) & SSSR_BSY) && --limit) cpu_relax(); return limit; @@ -494,7 +494,7 @@ static int wait_dma_channel_stop(int channel) { unsigned long limit = loops_per_jiffy << 1; - while (!(DCSR(channel) & DCSR_STOPSTATE) && limit--) + while (!(DCSR(channel) & DCSR_STOPSTATE) && --limit) cpu_relax(); return limit; -- 2.41.0