]> git.karo-electronics.de Git - linux-beck.git/commitdiff
usb: gadget: f_mass_storage: reset endpoint driver data when disabled
authorPeter Oh <poh@broadcom.com>
Mon, 16 Sep 2013 21:21:14 +0000 (14:21 -0700)
committerFelipe Balbi <balbi@ti.com>
Tue, 17 Sep 2013 16:07:14 +0000 (11:07 -0500)
Gadgets endpoint driver data is a criteria to judge that
whether the endpoints are in use or not. When gadget gets
assigned an endpoint from endpoint list, they check its
driver data if the driver data is NULL.

If the driver data is not NULL then they regard it as in use.
Therefore all of gadgets should reset their endpoints driver
data to NULL as they are disabled. Otherwise it causes a leak
of endpoint resource.

Signed-off-by: Peter Oh <poh@broadcom.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/gadget/f_mass_storage.c

index 313b835eedfd58948d23a96a85ade673347e8114..a01d7d38c01685135a503885342be7f9ec63ebbd 100644 (file)
@@ -2260,10 +2260,12 @@ reset:
                /* Disable the endpoints */
                if (fsg->bulk_in_enabled) {
                        usb_ep_disable(fsg->bulk_in);
+                       fsg->bulk_in->driver_data = NULL;
                        fsg->bulk_in_enabled = 0;
                }
                if (fsg->bulk_out_enabled) {
                        usb_ep_disable(fsg->bulk_out);
+                       fsg->bulk_out->driver_data = NULL;
                        fsg->bulk_out_enabled = 0;
                }