[PATCH 07/37] usb: host: xhci: WARN() if we interrupt without event_ring

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If we get an interrupt while we don't have an allocated event_ring, that
means we're enabling IRQs far too early. Instead of just printing an
error message, let's make sure to add a scary-looking Stack Trace so
people report these things and we fix them.

Eventually, when we're happy that this doesn't happen, we should just
remove this altogether.

Signed-off-by: Felipe Balbi <felipe.balbi@xxxxxxxxxxxxxxx>
---
 drivers/usb/host/xhci-ring.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 772e07e2ef16..0fd990603f77 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -2526,14 +2526,16 @@ static int handle_tx_event(struct xhci_hcd *xhci,
 static int xhci_handle_event(struct xhci_hcd *xhci)
 {
 	union xhci_trb *event;
+	struct device *dev;
 	int update_ptrs = 1;
 	int ret;
 
+	dev = xhci_to_hcd(xhci)->self.controller;
+
 	/* Event ring hasn't been allocated yet. */
-	if (!xhci->event_ring || !xhci->event_ring->dequeue) {
-		xhci_err(xhci, "ERROR event ring not ready\n");
+	if (dev_WARN_ONCE(dev, !xhci->event_ring || !xhci->event_ring->dequeue,
+					"event ring not ready\n"))
 		return -ENOMEM;
-	}
 
 	event = xhci->event_ring->dequeue;
 	/* Does the HC or OS own the TRB? */
-- 
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux