瀏覽代碼

usb: gadget: f_mass_storage: reset endpoint driver data when disabled

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>
Peter Oh 11 年之前
父節點
當前提交
7f2ccc8cb2
共有 1 個文件被更改,包括 2 次插入0 次删除
  1. 2 0
      drivers/usb/gadget/f_mass_storage.c

+ 2 - 0
drivers/usb/gadget/f_mass_storage.c

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