From bcd0d9b5682fc6c233bce8ede7e444184f2196ca Mon Sep 17 00:00:00 2001 From: Alan Stern Date: Fri, 20 Feb 2009 16:33:08 -0500 Subject: [PATCH] --- yaml --- r: 131884 b: refs/heads/master c: 67f5a4ba9741fcef3f4db3509ad03565d9e33af2 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/drivers/usb/core/message.c | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/[refs] b/[refs] index e9e5bce36b88..52eb95b86130 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 54b9ed35aea88b05d711884a3c2dc21bba047bd8 +refs/heads/master: 67f5a4ba9741fcef3f4db3509ad03565d9e33af2 diff --git a/trunk/drivers/usb/core/message.c b/trunk/drivers/usb/core/message.c index 31fb204f44c6..49e7f56e0d7f 100644 --- a/trunk/drivers/usb/core/message.c +++ b/trunk/drivers/usb/core/message.c @@ -653,7 +653,7 @@ int usb_get_descriptor(struct usb_device *dev, unsigned char type, if (result <= 0 && result != -ETIMEDOUT) continue; if (result > 1 && ((u8 *)buf)[1] != type) { - result = -EPROTO; + result = -ENODATA; continue; } break; @@ -696,8 +696,13 @@ static int usb_get_string(struct usb_device *dev, unsigned short langid, USB_REQ_GET_DESCRIPTOR, USB_DIR_IN, (USB_DT_STRING << 8) + index, langid, buf, size, USB_CTRL_GET_TIMEOUT); - if (!(result == 0 || result == -EPIPE)) - break; + if (result == 0 || result == -EPIPE) + continue; + if (result > 1 && ((u8 *) buf)[1] != USB_DT_STRING) { + result = -ENODATA; + continue; + } + break; } return result; }