From: Vahram Aharonyan Date: Thu, 28 Apr 2016 03:20:46 +0000 (-0700) Subject: UPSTREAM: usb: dwc2: gadget: Check for ep0 in enable X-Git-Tag: firefly_0821_release~858 X-Git-Url: http://plrg.eecs.uci.edu/git/?p=firefly-linux-kernel-4.4.55.git;a=commitdiff_plain;h=4e026285ea55a260ec07b774012a0131d4fc85a0 UPSTREAM: 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. Change-Id: Idf4bf147a52ff9dca294f76263438e41cc511cfc Signed-off-by: Vahram Aharonyan Signed-off-by: John Youn Signed-off-by: Felipe Balbi Signed-off-by: Huang, Tao (cherry picked from commit 8c3d609275f7f39d308e5c40a6220c67454f7a28) --- diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 818f158232bb..d330190f58ef 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) {