From: Roel Kluin Date: Thu, 18 Jun 2009 23:49:13 +0000 (-0700) Subject: dtlk: off by one in {read,write}_tts() X-Git-Tag: upstream/snapshot3+hdmi~18402 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4390b9e0cfa30c2b1a4d821748d7948fd85356df;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git dtlk: off by one in {read,write}_tts() With a postfix increment retries is incremented beyond DTLK_MAX_RETRIES so the error message is not displayed correctly. Signed-off-by: Roel Kluin Cc: James R. Van Zandt Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/char/dtlk.c b/drivers/char/dtlk.c index 6b900b2..52e0658 100644 --- a/drivers/char/dtlk.c +++ b/drivers/char/dtlk.c @@ -571,7 +571,7 @@ static char dtlk_read_tts(void) portval = inb_p(dtlk_port_tts); } while ((portval & TTS_READABLE) == 0 && retries++ < DTLK_MAX_RETRIES); - if (retries == DTLK_MAX_RETRIES) + if (retries > DTLK_MAX_RETRIES) printk(KERN_ERR "dtlk_read_tts() timeout\n"); ch = inb_p(dtlk_port_tts); /* input from TTS port */ @@ -583,7 +583,7 @@ static char dtlk_read_tts(void) portval = inb_p(dtlk_port_tts); } while ((portval & TTS_READABLE) != 0 && retries++ < DTLK_MAX_RETRIES); - if (retries == DTLK_MAX_RETRIES) + if (retries > DTLK_MAX_RETRIES) printk(KERN_ERR "dtlk_read_tts() timeout\n"); TRACE_RET; @@ -640,7 +640,7 @@ static char dtlk_write_tts(char ch) while ((inb_p(dtlk_port_tts) & TTS_WRITABLE) == 0 && retries++ < DTLK_MAX_RETRIES) /* DT ready? */ ; - if (retries == DTLK_MAX_RETRIES) + if (retries > DTLK_MAX_RETRIES) printk(KERN_ERR "dtlk_write_tts() timeout\n"); outb_p(ch, dtlk_port_tts); /* output to TTS port */