From: Oleg Matcovschi Date: Fri, 11 Mar 2011 18:24:30 +0000 (-0800) Subject: usb: gadget: composite: USB_GET_CONFIGURATION must return 0 in unconfigured state. X-Git-Tag: firefly_0821_release~7613^2~668 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=e67dd1611d5330ba9d41ba9ccdc78d6ff2963398;p=firefly-linux-kernel-4.4.55.git usb: gadget: composite: USB_GET_CONFIGURATION must return 0 in unconfigured state. Change-Id: I5212ca9990308d0c4ae6a55c60cba42d6b0e4fee Signed-off-by: Oleg Matcovschi --- diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index 42a948e49323..c9ae8bba6962 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c @@ -1013,12 +1013,11 @@ composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) case USB_REQ_GET_CONFIGURATION: if (ctrl->bRequestType != USB_DIR_IN) goto unknown; - if (cdev->config) { + if (cdev->config) *(u8 *)req->buf = cdev->config->bConfigurationValue; - value = min(w_length, (u16) 1); - } else { + else *(u8 *)req->buf = 0; - } + value = min(w_length, (u16) 1); break; /* function drivers must handle get/set altsetting; if there's