From 8caafc429a111550c379b8cb217918335d54fb42 Mon Sep 17 00:00:00 2001 From: Mathias Nyman Date: Mon, 16 Oct 2017 14:06:08 +0300 Subject: [PATCH] xhci: Don't show incorrect WARN message about events for empty rings xHC will generate events for short transfer both on the TRB that was short, and for the last TRB in the TD. This means that for TDs with several TRBs we can get two transfer events for the same TD. The driver will handle the TD after the first short event, and remove it from its internal list. Driver then incorrectly prints a warning for the second event: WARN Event TRB for slot x ep y with no TDs queued Fix this by not printing a warning if we get a event on a empty list if the previous event was a short event. Signed-off-by: Mathias Nyman --- drivers/usb/host/xhci-ring.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index fb25c10..87158a9 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -2485,12 +2485,17 @@ static int handle_tx_event(struct xhci_hcd *xhci, */ if (list_empty(&ep_ring->td_list)) { /* + * Don't print wanings in the following cases: * A stopped endpoint may generate an extra completion - * event if the device was suspended. Don't print - * warnings. + * event if the device was suspended. Or, + * a second event for a TD is generated for the last + * TRB if the previous event was a short event mid TD. + * TD is alrady removed from list. */ + if (!(trb_comp_code == COMP_STOPPED || - trb_comp_code == COMP_STOPPED_LENGTH_INVALID)) { + trb_comp_code == COMP_STOPPED_LENGTH_INVALID || + ep_ring->last_td_was_short)) { xhci_warn(xhci, "WARN Event TRB for slot %d ep %d with no TDs queued?\n", TRB_TO_SLOT_ID(le32_to_cpu(event->flags)), ep_index); -- 2.7.4