summaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorDaniel Mack <daniel@caiaq.de>2009-03-20 19:58:57 +0100
committerGreg Kroah-Hartman <gregkh@suse.de>2009-03-24 16:20:45 -0700
commitb7af0bb26899bb47ae16fb41d2296111b0784a56 (patch)
tree3b3ccddfc8aeb0eddf46afab31b826e7815a7be3 /drivers/usb
parent4c24b6d045a9d355c95ca4e6beb10ce2fd263390 (diff)
downloadlinux-b7af0bb26899bb47ae16fb41d2296111b0784a56.tar.gz
linux-b7af0bb26899bb47ae16fb41d2296111b0784a56.tar.bz2
linux-b7af0bb26899bb47ae16fb41d2296111b0784a56.zip
USB: allow malformed LANGID descriptors
When an USB hardware does not provide a valid LANGID, fall back to value zero which is still a reasonable default for most devices. Signed-off-by: Daniel Mack <daniel@caiaq.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/core/message.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index 293a30d78d24..30a0690f3683 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -804,18 +804,16 @@ int usb_string(struct usb_device *dev, int index, char *buf, size_t size)
dev_err(&dev->dev,
"string descriptor 0 read error: %d\n",
err);
- goto errout;
} else if (err < 4) {
dev_err(&dev->dev, "string descriptor 0 too short\n");
- err = -EINVAL;
- goto errout;
} else {
- dev->have_langid = 1;
dev->string_langid = tbuf[2] | (tbuf[3] << 8);
/* always use the first langid listed */
dev_dbg(&dev->dev, "default language 0x%04x\n",
dev->string_langid);
}
+
+ dev->have_langid = 1;
}
err = usb_string_sub(dev, dev->string_langid, index, tbuf);