Skip to contentSkip to conversation

usb: xhci: dbc: Don't free all memory with spinlock held

PATCH New Mathias Nyman 1 participant 1 message Mar 22, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 2/3 usb: xhci: dbc: Don't free all memory with spinlock held

The xhci debug capability (DbC) feature did its memory cleanup with spinlock held. dma_free_coherent() warns if called with interrupts disabled

move the memory cleanup outside the spinlock

---
 drivers/usb/host/xhci-dbgcap.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/usb/host/xhci-dbgcap.c +3 -2
index c78be57..d932cc3 100644
@@ -516,7 +516,6 @@ static int xhci_do_dbc_stop(struct xhci_hcd *xhci)
 		return -1;
 
 	writel(0, &dbc->regs->control);
-	xhci_dbc_mem_cleanup(xhci);
 	dbc->state = DS_DISABLED;
 
 	return 0;
@@ -562,8 +561,10 @@ static void xhci_dbc_stop(struct xhci_hcd *xhci)
 	ret = xhci_do_dbc_stop(xhci);
 	spin_unlock_irqrestore(&dbc->lock, flags);
 
-	if (!ret)
+	if (!ret) {
+		xhci_dbc_mem_cleanup(xhci);
 		pm_runtime_put_sync(xhci_to_hcd(xhci)->self.controller);
+	}
 }
 
 static void
Signature · 1 line
2.7.4