Skip to contentSkip to conversation

amba_kmi_write() timeleft reaches -1 rather than 0

PATCH Applied Roel Kluin 2 participants 2 messages Jan 31, 2009 – Feb 2, 2009

Subsystems (3)
lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 amba_kmi_write() timeleft reaches -1 rather than 0

With a postfix decrement timeleft reaches -1 rather than 0, but after the loop it is tested to have become 0.

---

drivers/input/serio/ambakmi.c +1 -1
index b10ffae..ab3299c 100644
@@ -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)
maintainer Applied
#1 lore raw
Quoted 4 lines · Roel Kluin

With a postfix decrement timeleft reaches -1 rather than 0, but after the loop it is tested to have become 0.

Applied, thank you Roel.

Signature · 1 line
Dmitry