diff mbox series

usb: dwc2: Fix ep disable spinlock flow.

Message ID 6f774b501928599e739143aa3ca0b6a8b4424d79.1541404559.git.hminas@synopsys.com (mailing list archive)
State New, archived
Headers show
Series usb: dwc2: Fix ep disable spinlock flow. | expand

Commit Message

Minas Harutyunyan Nov. 5, 2018, 7:57 a.m. UTC
Changed spinlock flow to fix smatch warnings.

Fixes: dccf1bad4be7 ("usb: dwc2: Disable all EP's on disconnect")
Signed-off-by: Minas Harutyunyan <hminas@synopsys.com>
---
 drivers/usb/dwc2/gadget.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index 2d6d2c8244de..8eb25e3597b0 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -4088,9 +4088,7 @@  static int dwc2_hsotg_ep_disable(struct usb_ep *ep)
 
 	epctrl_reg = dir_in ? DIEPCTL(index) : DOEPCTL(index);
 
-	locked = spin_is_locked(&hsotg->lock);
-	if (!locked)
-		spin_lock_irqsave(&hsotg->lock, flags);
+	locked = spin_trylock_irqsave(&hsotg->lock, flags);
 
 	ctrl = dwc2_readl(hsotg, epctrl_reg);
 
@@ -4114,7 +4112,7 @@  static int dwc2_hsotg_ep_disable(struct usb_ep *ep)
 	hs_ep->fifo_index = 0;
 	hs_ep->fifo_size = 0;
 
-	if (!locked)
+	if (locked)
 		spin_unlock_irqrestore(&hsotg->lock, flags);
 
 	return 0;