USB: serial gadget: Disable endpoints on unload
authorVitaly Bordug <vitb@kernel.crashing.org>
Wed, 26 Sep 2007 20:36:22 +0000 (00:36 +0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 12 Oct 2007 21:55:30 +0000 (14:55 -0700)
After Serial gadget is being unloaded, neither serial itself, nor other
gadget stuff can be loaded subsequently.

Signed-off-by: Vitaly Bordug <vitb@kernel.crashing.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/gadget/serial.c

index afdf71f76f7e42c3b33107c632cbc4bc138bb4b7..a2a1ebc947d21e91f8cbd81230ace1470d19b646 100644 (file)
@@ -1470,6 +1470,12 @@ static void /* __init_or_exit */ gs_unbind(struct usb_gadget *gadget)
                        dev->dev_ctrl_req = NULL;
                }
                gs_free_ports(dev);
+               if (dev->dev_notify_ep)
+                       usb_ep_disable(dev->dev_notify_ep);
+               if (dev->dev_in_ep)
+                       usb_ep_disable(dev->dev_in_ep);
+               if (dev->dev_out_ep)
+                       usb_ep_disable(dev->dev_out_ep);
                kfree(dev);
                set_gadget_data(gadget, NULL);
        }