]> Pileus Git - ~andy/linux/blobdiff - drivers/usb/gadget/epautoconf.c
Merge branch 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[~andy/linux] / drivers / usb / gadget / epautoconf.c
index e0e6375ef5dd7693cb89ff24397223e94f26aa7a..51f3d42f5a64808533c4412fb1d632c3accde8d1 100644 (file)
@@ -275,24 +275,24 @@ struct usb_ep *usb_ep_autoconfig_ss(
                /* ep-e, ep-f are PIO with only 64 byte fifos */
                ep = find_ep (gadget, "ep-e");
                if (ep && ep_matches(gadget, ep, desc, ep_comp))
-                       return ep;
+                       goto found_ep;
                ep = find_ep (gadget, "ep-f");
                if (ep && ep_matches(gadget, ep, desc, ep_comp))
-                       return ep;
+                       goto found_ep;
 
        } else if (gadget_is_goku (gadget)) {
                if (USB_ENDPOINT_XFER_INT == type) {
                        /* single buffering is enough */
                        ep = find_ep(gadget, "ep3-bulk");
                        if (ep && ep_matches(gadget, ep, desc, ep_comp))
-                               return ep;
+                               goto found_ep;
                } else if (USB_ENDPOINT_XFER_BULK == type
                                && (USB_DIR_IN & desc->bEndpointAddress)) {
                        /* DMA may be available */
                        ep = find_ep(gadget, "ep2-bulk");
                        if (ep && ep_matches(gadget, ep, desc,
                                              ep_comp))
-                               return ep;
+                               goto found_ep;
                }
 
 #ifdef CONFIG_BLACKFIN
@@ -311,18 +311,22 @@ struct usb_ep *usb_ep_autoconfig_ss(
                } else
                        ep = NULL;
                if (ep && ep_matches(gadget, ep, desc, ep_comp))
-                       return ep;
+                       goto found_ep;
 #endif
        }
 
        /* Second, look at endpoints until an unclaimed one looks usable */
        list_for_each_entry (ep, &gadget->ep_list, ep_list) {
                if (ep_matches(gadget, ep, desc, ep_comp))
-                       return ep;
+                       goto found_ep;
        }
 
        /* Fail */
        return NULL;
+found_ep:
+       ep->desc = NULL;
+       ep->comp_desc = NULL;
+       return ep;
 }
 
 /**