Skip to content

Commit

Permalink
spi: pxa2xx: limit reaches -1
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Eric Miao <[email protected]>
Cc: David Brownell <[email protected]>
Cc: Russell King <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
RoelKluin authored and torvalds committed Apr 21, 2009
1 parent dc8c7f8 commit 306c68a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/spi/pxa2xx_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 306c68a

Please sign in to comment.