]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
usb: Handle audio extension endpoint descriptor in usb_parse_config()
authorBin Meng <bmeng.cn@gmail.com>
Mon, 18 Sep 2017 13:40:40 +0000 (06:40 -0700)
committerMarek Vasut <marex@denx.de>
Sun, 1 Oct 2017 14:32:53 +0000 (16:32 +0200)
Normal endpoint descriptor size is 7, but for audio extension it is
9. Handle that correctly when parsing endpoint descriptor.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
common/usb.c

index 0904259757371a25b2cb25f2d1189b6a53a43d17..6cb92ef4f52d8afede9dd94878edde0f95380ef9 100644 (file)
@@ -437,12 +437,13 @@ static int usb_parse_config(struct usb_device *dev,
                        }
                        break;
                case USB_DT_ENDPOINT:
-                       if (head->bLength != USB_DT_ENDPOINT_SIZE) {
+                       if (head->bLength != USB_DT_ENDPOINT_SIZE &&
+                           head->bLength != USB_DT_ENDPOINT_AUDIO_SIZE) {
                                printf("ERROR: Invalid USB EP length (%d)\n",
                                        head->bLength);
                                break;
                        }
-                       if (index + USB_DT_ENDPOINT_SIZE >
+                       if (index + head->bLength >
                            dev->config.desc.wTotalLength) {
                                puts("USB EP descriptor overflowed buffer!\n");
                                break;