]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
usb: gadget: udc-core: fix wrong call order
authorFelipe Balbi <balbi@ti.com>
Fri, 27 Apr 2012 08:02:15 +0000 (11:02 +0300)
committerBen Hutchings <ben@decadent.org.uk>
Fri, 11 May 2012 12:14:04 +0000 (13:14 +0100)
commit 83a787a71e034244a9fd1d5988fe18f226341417 upstream.

commit 6d258a4 (usb: gadget: udc-core: stop UDC on device-initiated
disconnect) introduced another case of asymmetric calls when issuing
a device-initiated disconnect. Fix it.

Reported-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/usb/gadget/udc-core.c

index d73ccfe0f8f6e0dc1ff414d9f781ec7c23d8f4c8..d81fb2540a088afa1386548f994dbb4247793380 100644 (file)
@@ -363,9 +363,9 @@ static ssize_t usb_udc_softconn_store(struct device *dev,
                        usb_gadget_udc_start(udc->gadget, udc->driver);
                usb_gadget_connect(udc->gadget);
        } else if (sysfs_streq(buf, "disconnect")) {
+               usb_gadget_disconnect(udc->gadget);
                if (udc_is_newstyle(udc))
                        usb_gadget_udc_stop(udc->gadget, udc->driver);
-               usb_gadget_disconnect(udc->gadget);
        } else {
                dev_err(dev, "unsupported command '%s'\n", buf);
                return -EINVAL;