diff options
author | Roel Kluin <roel.kluin@gmail.com> | 2009-04-21 15:24:46 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-21 16:41:49 -0400 |
commit | 306c68aaa7c62010428196d309fda30b6bf57710 (patch) | |
tree | 0302de1a38b1c3e0381d546d668e741e39abbfcd /drivers/spi/pxa2xx_spi.c | |
parent | dc8c7f8919aeb2d89247bdf302ad68b569a2b1e2 (diff) |
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 <roel.kluin@gmail.com>
Acked-by: Eric Miao <eric.miao@marvell.com>
Cc: David Brownell <david-b@pacbell.net>
Cc: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/spi/pxa2xx_spi.c')
-rw-r--r-- | drivers/spi/pxa2xx_spi.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/spi/pxa2xx_spi.c b/drivers/spi/pxa2xx_spi.c index 1a00b415bcc4..885194a07418 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) | |||
213 | while (read_SSSR(reg) & SSSR_RNE) { | 213 | while (read_SSSR(reg) & SSSR_RNE) { |
214 | read_SSDR(reg); | 214 | read_SSDR(reg); |
215 | } | 215 | } |
216 | } while ((read_SSSR(reg) & SSSR_BSY) && limit--); | 216 | } while ((read_SSSR(reg) & SSSR_BSY) && --limit); |
217 | write_SSSR(SSSR_ROR, reg); | 217 | write_SSSR(SSSR_ROR, reg); |
218 | 218 | ||
219 | return limit; | 219 | return limit; |
@@ -484,7 +484,7 @@ static int wait_ssp_rx_stall(void const __iomem *ioaddr) | |||
484 | { | 484 | { |
485 | unsigned long limit = loops_per_jiffy << 1; | 485 | unsigned long limit = loops_per_jiffy << 1; |
486 | 486 | ||
487 | while ((read_SSSR(ioaddr) & SSSR_BSY) && limit--) | 487 | while ((read_SSSR(ioaddr) & SSSR_BSY) && --limit) |
488 | cpu_relax(); | 488 | cpu_relax(); |
489 | 489 | ||
490 | return limit; | 490 | return limit; |
@@ -494,7 +494,7 @@ static int wait_dma_channel_stop(int channel) | |||
494 | { | 494 | { |
495 | unsigned long limit = loops_per_jiffy << 1; | 495 | unsigned long limit = loops_per_jiffy << 1; |
496 | 496 | ||
497 | while (!(DCSR(channel) & DCSR_STOPSTATE) && limit--) | 497 | while (!(DCSR(channel) & DCSR_STOPSTATE) && --limit) |
498 | cpu_relax(); | 498 | cpu_relax(); |
499 | 499 | ||
500 | return limit; | 500 | return limit; |