Skip to content

Commit

Permalink
powerpc/gamecube/wii: Fix off-by-one error in ugecon/usbgecko_udbg
Browse files Browse the repository at this point in the history
The retry logic in ug_putc() is broken.

If the TX fifo is not ready and the counter runs out it will have a
value of -1 and no transfer should be attempted. Also, a counter
with a value of 0 means that the TX fifo got ready in the last try
and the transfer should be attempted.

Reported-by: "Juha Leppanen" <juha_motorsportcom@luukku.com>
Signed-off-by: "Juha Leppanen" <juha_motorsportcom@luukku.com>
Signed-off-by: Albert Herranz <albert_herranz@yahoo.es>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
  • Loading branch information
Albert Herranz authored and Benjamin Herrenschmidt committed Dec 18, 2009
1 parent 38e1313 commit 698cd33
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion arch/powerpc/boot/ugecon.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ static void ug_putc(char ch)

while (!ug_is_txfifo_ready() && count--)
barrier();
if (count)
if (count >= 0)
ug_raw_putc(ch);
}

Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/embedded6xx/usbgecko_udbg.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ static void ug_putc(char ch)

while (!ug_is_txfifo_ready() && count--)
barrier();
if (count)
if (count >= 0)
ug_raw_putc(ch);
}

Expand Down

0 comments on commit 698cd33

Please sign in to comment.