diff options
author | Daniel Mack <daniel@caiaq.de> | 2009-03-20 14:58:57 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-03-24 19:20:45 -0400 |
commit | b7af0bb26899bb47ae16fb41d2296111b0784a56 (patch) | |
tree | 3b3ccddfc8aeb0eddf46afab31b826e7815a7be3 /drivers | |
parent | 4c24b6d045a9d355c95ca4e6beb10ce2fd263390 (diff) |
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')
-rw-r--r-- | drivers/usb/core/message.c | 6 |
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) | |||
804 | dev_err(&dev->dev, | 804 | dev_err(&dev->dev, |
805 | "string descriptor 0 read error: %d\n", | 805 | "string descriptor 0 read error: %d\n", |
806 | err); | 806 | err); |
807 | goto errout; | ||
808 | } else if (err < 4) { | 807 | } else if (err < 4) { |
809 | dev_err(&dev->dev, "string descriptor 0 too short\n"); | 808 | dev_err(&dev->dev, "string descriptor 0 too short\n"); |
810 | err = -EINVAL; | ||
811 | goto errout; | ||
812 | } else { | 809 | } else { |
813 | dev->have_langid = 1; | ||
814 | dev->string_langid = tbuf[2] | (tbuf[3] << 8); | 810 | dev->string_langid = tbuf[2] | (tbuf[3] << 8); |
815 | /* always use the first langid listed */ | 811 | /* always use the first langid listed */ |
816 | dev_dbg(&dev->dev, "default language 0x%04x\n", | 812 | dev_dbg(&dev->dev, "default language 0x%04x\n", |
817 | dev->string_langid); | 813 | dev->string_langid); |
818 | } | 814 | } |
815 | |||
816 | dev->have_langid = 1; | ||
819 | } | 817 | } |
820 | 818 | ||
821 | err = usb_string_sub(dev, dev->string_langid, index, tbuf); | 819 | err = usb_string_sub(dev, dev->string_langid, index, tbuf); |