aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/dwc3/gadget.c
diff options
context:
space:
mode:
authorFelipe Balbi <balbi@ti.com>2012-08-15 05:28:29 -0400
committerFelipe Balbi <balbi@ti.com>2012-08-15 05:28:29 -0400
commitc6f83f386c2f7987a344368e33e55840c12bd38f (patch)
tree4d1e36e1b87fc5b1f5931c7e9c5e6b858c675d83 /drivers/usb/dwc3/gadget.c
parentb7e38aa67d73cbb9d5d2e1e5de379f473fa7d7bf (diff)
usb: dwc3: gadget: warn about endpoint already enabled before changing ep name
In case some gadget driver tries to enable an endpoint which is already enabled, we print a nice WARN so we can track broken gadget drivers. The only problem is that we're printing the WARN when we already changed endpoint's name, which would result in endpoints named as: ep1in-bulk-bulk-bulk-bulk-bulk-bulk-bulk To prevent that, we will continue to print the WARN, but do so before changing endpoint's name and return early. Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/dwc3/gadget.c')
-rw-r--r--drivers/usb/dwc3/gadget.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index dd5945ca9c86..029cf0651564 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -642,6 +642,12 @@ static int dwc3_gadget_ep_enable(struct usb_ep *ep,
642 dep = to_dwc3_ep(ep); 642 dep = to_dwc3_ep(ep);
643 dwc = dep->dwc; 643 dwc = dep->dwc;
644 644
645 if (dep->flags & DWC3_EP_ENABLED) {
646 dev_WARN_ONCE(dwc->dev, true, "%s is already enabled\n",
647 dep->name);
648 return 0;
649 }
650
645 switch (usb_endpoint_type(desc)) { 651 switch (usb_endpoint_type(desc)) {
646 case USB_ENDPOINT_XFER_CONTROL: 652 case USB_ENDPOINT_XFER_CONTROL:
647 strlcat(dep->name, "-control", sizeof(dep->name)); 653 strlcat(dep->name, "-control", sizeof(dep->name));
@@ -659,12 +665,6 @@ static int dwc3_gadget_ep_enable(struct usb_ep *ep,
659 dev_err(dwc->dev, "invalid endpoint transfer type\n"); 665 dev_err(dwc->dev, "invalid endpoint transfer type\n");
660 } 666 }
661 667
662 if (dep->flags & DWC3_EP_ENABLED) {
663 dev_WARN_ONCE(dwc->dev, true, "%s is already enabled\n",
664 dep->name);
665 return 0;
666 }
667
668 dev_vdbg(dwc->dev, "Enabling %s\n", dep->name); 668 dev_vdbg(dwc->dev, "Enabling %s\n", dep->name);
669 669
670 spin_lock_irqsave(&dwc->lock, flags); 670 spin_lock_irqsave(&dwc->lock, flags);