From 8c8650181904cee37721fa303622cd37255d51d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Fran=C4=8De=C5=A1kin?= Date: Thu, 30 Aug 2012 09:24:39 +0200 Subject: [PATCH] MUSB driver: Timeout is never detected as the while loop does not end 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 CC: Marek Vasut ? --- drivers/usb/musb/musb_hcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/musb/musb_hcd.c b/drivers/usb/musb/musb_hcd.c index 2df52c1c33f..8d44c4657f4 100644 --- a/drivers/usb/musb/musb_hcd.c +++ b/drivers/usb/musb/musb_hcd.c @@ -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;