public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "xinhui.pan" <xinhuix.pan@intel.com>
To: linux-kernel@vger.kernel.org
Cc: gregkh@linuxfoundation.org, stern@rowland.harvard.edu,
	sarah.a.sharp@linux.intel.com, dan.j.williams@intel.com,
	burzalodowa@gmail.com, yanmin_zhang@linux.intel.com
Subject: [PATCH] usb/core/hub.c: return immediately when hub_port_init hits timedout
Date: Fri, 07 Mar 2014 14:15:48 +0800	[thread overview]
Message-ID: <53196414.8090703@intel.com> (raw)

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

             reply	other threads:[~2014-03-07  6:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-07  6:15 xinhui.pan [this message]
2014-03-07  6:47 ` [PATCH] usb/core/hub.c: return immediately when hub_port_init hits timedout Greg KH
2014-03-07  7:32   ` xinhui.pan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53196414.8090703@intel.com \
    --to=xinhuix.pan@intel.com \
    --cc=burzalodowa@gmail.com \
    --cc=dan.j.williams@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sarah.a.sharp@linux.intel.com \
    --cc=stern@rowland.harvard.edu \
    --cc=yanmin_zhang@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox