Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a318834e authored by Manu Gautam's avatar Manu Gautam Committed by Stephen Boyd
Browse files

usb: gadget: Move req->length check from function drivers to composite



req->legth is set as 0 before calling individual function driver's
setup routines. Hence, check for the buffer length in composite_setup
only.
Also, change max buffer size to 4k to accomodate our descriptors.

Change-Id: Ic96408210e7e5576928a7147d2d8a57fa620d287
Signed-off-by: default avatarManu Gautam <mgautam@codeaurora.org>
parent 0b670228
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1228,6 +1228,10 @@ composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
	u8				endp;
	struct usb_configuration *c;


	if (w_length > USB_COMP_EP0_BUFSIZ)
		return value;

	/* partial re-init of the response message; the function or the
	 * gadget might need to intercept e.g. a control-OUT completion
	 * when we delegate to it.
+1 −1
Original line number Diff line number Diff line
@@ -51,7 +51,7 @@
#define USB_GADGET_DELAYED_STATUS       0x7fff	/* Impossibly large value */

/* big enough to hold our biggest descriptor */
#define USB_COMP_EP0_BUFSIZ	1024
#define USB_COMP_EP0_BUFSIZ	4096

#define USB_MS_TO_HS_INTERVAL(x)	(ilog2((x * 1000 / 125)) + 1)
struct usb_configuration;