diff options
author | Vahram Aharonyan <vahrama@synopsys.com> | 2016-04-28 03:20:46 (GMT) |
---|---|---|
committer | Felipe Balbi <felipe.balbi@linux.intel.com> | 2016-04-28 06:40:16 (GMT) |
commit | 8c3d609275f7f39d308e5c40a6220c67454f7a28 (patch) | |
tree | 68736b2d5917d6d502270270f785570b53a73276 /drivers/usb/dwc2 | |
parent | 7b9cc7a2b101cc73f6abe3468441381c98817e54 (diff) | |
download | linux-8c3d609275f7f39d308e5c40a6220c67454f7a28.tar.xz |
usb: dwc2: gadget: Check for ep0 in enable
Replaced the WARN_ON with a check and return of -EINVAL in the
dwc2_hsotg_ep_enable function if ep0 is passed in.
Signed-off-by: Vahram Aharonyan <vahrama@synopsys.com>
Signed-off-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Diffstat (limited to 'drivers/usb/dwc2')
-rw-r--r-- | drivers/usb/dwc2/gadget.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 818f158..d330190 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -2631,7 +2631,10 @@ static int dwc2_hsotg_ep_enable(struct usb_ep *ep, desc->wMaxPacketSize, desc->bInterval); /* not to be called for EP0 */ - WARN_ON(index == 0); + if (index == 0) { + dev_err(hsotg->dev, "%s: called for EP 0\n", __func__); + return -EINVAL; + } dir_in = (desc->bEndpointAddress & USB_ENDPOINT_DIR_MASK) ? 1 : 0; if (dir_in != hs_ep->dir_in) { |