@@ -1388,6 +1388,25 @@ static int xhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flag
return ret;
}
+static void xhci_manually_free_td(struct xhci_hcd *xhci, struct urb *urb)
+{
+ struct urb_priv *urb_priv = urb->hcpriv;
+ int i;
+
+ xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb,
+ "HC halted, freeing TD manually.");
+
+ for (i = urb_priv->num_tds_done; i < urb_priv->num_tds; i++) {
+ struct xhci_td *td = &urb_priv->td[i];
+
+ if (!list_empty(&td->td_list))
+ list_del_init(&td->td_list);
+
+ if (!list_empty(&td->cancelled_td_list))
+ list_del_init(&td->cancelled_td_list);
+ }
+}
+
/*
* Remove the URB's TD from the endpoint ring. This may cause the HC to stop
* USB transfers, potentially stopping in the middle of a TRB buffer. The HC
@@ -1464,17 +1483,7 @@ static int xhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)
goto err_giveback;
if (xhci->xhc_state & XHCI_STATE_HALTED) {
- xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb,
- "HC halted, freeing TD manually.");
- for (i = urb_priv->num_tds_done;
- i < urb_priv->num_tds;
- i++) {
- td = &urb_priv->td[i];
- if (!list_empty(&td->td_list))
- list_del_init(&td->td_list);
- if (!list_empty(&td->cancelled_td_list))
- list_del_init(&td->cancelled_td_list);
- }
+ xhci_manually_free_td(xhci, urb);
goto err_giveback;
}
Cleanup only, no functional changes. Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com> --- drivers/usb/host/xhci.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-)