summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Roese <sr@denx.de>2015-01-09 14:54:55 +0100
committerMarek Vasut <marex@denx.de>2015-01-18 12:31:00 +0100
commit87ed6b1067a8b8cf2bf3fd900080164cef8e0b77 (patch)
treec4cbbfd9b98fffa7c22384ce0f4d94a99c83bcb5
parentab77f24119e80257de4ab017b877f92f96980562 (diff)
downloadu-boot-imx-87ed6b1067a8b8cf2bf3fd900080164cef8e0b77.zip
u-boot-imx-87ed6b1067a8b8cf2bf3fd900080164cef8e0b77.tar.gz
u-boot-imx-87ed6b1067a8b8cf2bf3fd900080164cef8e0b77.tar.bz2
usb: gadget: composite: Fix NULL pointer crash in USB compliance test
On the DXR2 board (AM335x using MUSB) the USB compliance test suite (USB 2.0 Command Verifier) will cause the board to crash and reset upon the "BOS Descriptor Test - Addressed state". Here the output from the DRX2 while running this test: GADGET DRIVER: usb_dnl_dfu musb-hdrc: peripheral reset irq lost! composite_setup (776) data abort pc : [<87f693ac>] lr : [<87f6911c>] sp : 86f33a58 ip : 00000000 fp : 86f3bbac r10: 00000f00 r9 : 86f33ef4 r8 : 86f37da8 r7 : 00000005 r6 : 86f33a90 r5 : 00000000 r4 : 86f37e30 r3 : 00000000 r2 : 00000000 r1 : 87f9c888 r0 : 00000016 Flags: Nzcv IRQs off FIQs on Mode SVC_32 Resetting CPU ... resetting ... By adding the case statement for USB_DT_BOS and therefore not running into the default case (jump to unkown label) this crash is fixed. Signed-off-by: Stefan Roese <sr@denx.de> Cc: Roger Meier <r.meier@siemens.com> Cc: Samuel Egli <samuel.egli@siemens.com> Cc: Enrico Leto <enrico.leto@siemens.com> Acked-by: Heiko Schocher <hs@denx.de> Cc: Lukasz Majewski <l.majewski@samsung.com> Cc: Marek Vasut <marex@denx.de>
-rw-r--r--drivers/usb/gadget/composite.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index a4c5606..98c2da6 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -761,6 +761,14 @@ composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
if (value >= 0)
value = min(w_length, (u16) value);
break;
+ case USB_DT_BOS:
+ /*
+ * The USB compliance test (USB 2.0 Command Verifier)
+ * issues this request. We should not run into the
+ * default path here. But return for now until
+ * the superspeed support is added.
+ */
+ break;
default:
goto unknown;
}