From: Vahram Aharonyan <[email protected]>

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 <[email protected]>
Signed-off-by: John Youn <[email protected]>
---
 drivers/usb/dwc2/gadget.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

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) {
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to