Cleanup only, no functional changes. Signed-off-by: Felipe Balbi <felipe.balbi@xxxxxxxxxxxxxxx> --- drivers/usb/host/xhci.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 6be3eb721157..5d2c24f58b34 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -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; } -- 2.16.1 -- 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