public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb/core/hub.c: return immediately when hub_port_init hits timedout
@ 2014-03-07  6:15 xinhui.pan
  2014-03-07  6:47 ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: xinhui.pan @ 2014-03-07  6:15 UTC (permalink / raw)
  To: linux-kernel
  Cc: gregkh, stern, sarah.a.sharp, dan.j.williams, burzalodowa,
	yanmin_zhang

From: "xinhui.pan" <xinhuiX.pan@intel.com>

some devices go crasy, we can't resume it even after reset. This case will
cause timeout again and again. What is worse, if there is a watchdog,
panic will be generated as timer expires. To prevent this, we just return
-ENODEV immediately. Later it will be re-enumerated.

Signed-off-by: xinhui.pan <xinhuiX.pan@intel.com>
---
 drivers/usb/core/hub.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 64ea219..c5d0d8d 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -4141,7 +4141,7 @@ hub_port_init (struct usb_hub *hub, struct usb_device *udev, int port1,
 						r = -EPROTO;
 					break;
 				}
-				if (r == 0)
+				if (r == 0 || r == -ETIMEDOUT)
 					break;
 			}
 			udev->descriptor.bMaxPacketSize0 =
@@ -4161,6 +4161,10 @@ hub_port_init (struct usb_hub *hub, struct usb_device *udev, int port1,
 				if (r != -ENODEV)
 					dev_err(&udev->dev, "device descriptor read/64, error %d\n",
 							r);
+				if (r == -ETIMEDOUT) {
+					retval = -ENODEV;
+					goto fail;
+				}
 				retval = -EMSGSIZE;
 				continue;
 			}
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-03-07  7:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-07  6:15 [PATCH] usb/core/hub.c: return immediately when hub_port_init hits timedout xinhui.pan
2014-03-07  6:47 ` Greg KH
2014-03-07  7:32   ` xinhui.pan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox