VENDOR: intel: usb: gadget: ffs: avoid disable ep twice

When FFS gadget function is disabled, gadget driver tries to
disable the endpoints twice, which triggers warning message
in device driver.

This patch ensures that usb_ep_disable() is not called again
after the endpoint has been disabled.

Signed-off-by: Jiebing Li <>
Signed-off-by: David Cohen <>

Bug: 26457812

Change-Id: I4e20bd0e918f0c26917f82f3cd0a513aa44d8499
Signed-off-by: Mihai Serban <>
diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c
index c36f660..c69598f 100644
--- a/drivers/usb/gadget/f_fs.c
+++ b/drivers/usb/gadget/f_fs.c
@@ -1541,7 +1541,7 @@
 	spin_lock_irqsave(&func->ffs->eps_lock, flags);
 	do {
 		/* pending requests get nuked */
-		if (likely(ep->ep))
+		if (ep->ep && epfile->ep)
 		epfile->ep = NULL;