]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
MUSB driver: Timeout is never detected as the while loop does not end
authorMatej Frančeškin <matej.franceskin@comtrade.com>
Thu, 30 Aug 2012 07:24:39 +0000 (09:24 +0200)
committerMarek Vasut <marex@denx.de>
Sat, 1 Sep 2012 14:21:53 +0000 (16:21 +0200)
Timeout variable is decremented once more when while condition is not met.
Following "if" does not detect correctly that timeout has occurred.
Because of this bug the "usb start" command on AM335X-EVM board did not detect correctly that USB device was not attached.

timeout = musb_cfg.timeout;
while (timeout--)
if (readb(&musbr->devctl) & MUSB_DEVCTL_HM)
  break;
/* if musb core is not in host mode, then return */
if (!timeout)
return -1;

Signed-off-by: Matej Franceskin <Matej.Franceskin@comtrade.com>
CC: Marek Vasut <matex@denx.de>?
drivers/usb/musb/musb_hcd.c

index 2df52c1c33f907eea83b2a8bacf2f338e0011bd9..8d44c4657f493005487af6133c9fcb7f8ab6ada0 100644 (file)
@@ -1113,7 +1113,7 @@ int usb_lowlevel_init(void)
         * should be a usb device connected.
         */
        timeout = musb_cfg.timeout;
-       while (timeout--)
+       while (--timeout)
                if (readb(&musbr->devctl) & MUSB_DEVCTL_HM)
                        break;