Browse Source

Input: ambakmi - fix timeout handling in amba_kmi_write()

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>
Roel Kluin 16 năm trước cách đây
mục cha
commit
4ab73761fa
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  1. 1 1
      drivers/input/serio/ambakmi.c

+ 1 - 1
drivers/input/serio/ambakmi.c

@@ -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)