From 698cd335a782561b79504d4e98c7df62b08e7abd Mon Sep 17 00:00:00 2001 From: Albert Herranz Date: Thu, 17 Dec 2009 08:33:41 +0000 Subject: powerpc/gamecube/wii: Fix off-by-one error in ugecon/usbgecko_udbg 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" Signed-off-by: "Juha Leppanen" Signed-off-by: Albert Herranz Signed-off-by: Benjamin Herrenschmidt --- arch/powerpc/platforms/embedded6xx/usbgecko_udbg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch/powerpc/platforms/embedded6xx/usbgecko_udbg.c') diff --git a/arch/powerpc/platforms/embedded6xx/usbgecko_udbg.c b/arch/powerpc/platforms/embedded6xx/usbgecko_udbg.c index edc956cc8b13..20a8ed91962e 100644 --- a/arch/powerpc/platforms/embedded6xx/usbgecko_udbg.c +++ b/arch/powerpc/platforms/embedded6xx/usbgecko_udbg.c @@ -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); } -- cgit v1.2.3