Skip to content

Commit

Permalink
Input: ambakmi - fix timeout handling in amba_kmi_write()
Browse files Browse the repository at this point in the history
With a postfix decrement timeleft reaches -1 rather than 0,
but after the loop it is tested to have become 0.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
  • Loading branch information
Roel Kluin authored and Dmitry Torokhov committed Feb 2, 2009
1 parent bc34496 commit 4ab7376
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/input/serio/ambakmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ static int amba_kmi_write(struct serio *io, unsigned char val)
struct amba_kmi_port *kmi = io->port_data;
unsigned int timeleft = 10000; /* timeout in 100ms */

while ((readb(KMISTAT) & KMISTAT_TXEMPTY) == 0 && timeleft--)
while ((readb(KMISTAT) & KMISTAT_TXEMPTY) == 0 && --timeleft)
udelay(10);

if (timeleft)
Expand Down

0 comments on commit 4ab7376

Please sign in to comment.