Skip to content

Commit 608b973

Browse files
Epicuriusgregkh
authored andcommitted
usb: xhci: remove goto 'cleanup' in handle_tx_event()
By removing the goto 'cleanup' statement, and replacing it with 'continue', 'break' and 'return', helps simplify the code and further showcase in which case the while loop iterates. This change prepares for the comprehensive handle_tx_event() rework. Signed-off-by: Niklas Neronin <[email protected]> Signed-off-by: Mathias Nyman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 26dffa4 commit 608b973

File tree

1 file changed

+21
-17
lines changed

1 file changed

+21
-17
lines changed

drivers/usb/host/xhci-ring.c

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2727,15 +2727,19 @@ static int handle_tx_event(struct xhci_hcd *xhci,
27272727
"still with TDs queued?\n",
27282728
TRB_TO_SLOT_ID(le32_to_cpu(event->flags)),
27292729
ep_index);
2730-
goto cleanup;
2730+
if (ep->skip)
2731+
break;
2732+
return 0;
27312733
case COMP_RING_OVERRUN:
27322734
xhci_dbg(xhci, "overrun event on endpoint\n");
27332735
if (!list_empty(&ep_ring->td_list))
27342736
xhci_dbg(xhci, "Overrun Event for slot %d ep %d "
27352737
"still with TDs queued?\n",
27362738
TRB_TO_SLOT_ID(le32_to_cpu(event->flags)),
27372739
ep_index);
2738-
goto cleanup;
2740+
if (ep->skip)
2741+
break;
2742+
return 0;
27392743
case COMP_MISSED_SERVICE_ERROR:
27402744
/*
27412745
* When encounter missed service error, one or more isoc tds
@@ -2770,7 +2774,9 @@ static int handle_tx_event(struct xhci_hcd *xhci,
27702774
xhci_warn(xhci,
27712775
"ERROR Unknown event condition %u for slot %u ep %u , HC probably busted\n",
27722776
trb_comp_code, slot_id, ep_index);
2773-
goto cleanup;
2777+
if (ep->skip)
2778+
break;
2779+
return 0;
27742780
}
27752781

27762782
do {
@@ -2834,14 +2840,14 @@ static int handle_tx_event(struct xhci_hcd *xhci,
28342840
*/
28352841
if (!ep_seg && (trb_comp_code == COMP_STOPPED ||
28362842
trb_comp_code == COMP_STOPPED_LENGTH_INVALID)) {
2837-
goto cleanup;
2843+
continue;
28382844
}
28392845

28402846
if (!ep_seg) {
28412847

28422848
if (ep->skip && usb_endpoint_xfer_isoc(&td->urb->ep->desc)) {
28432849
skip_isoc_td(xhci, td, ep, status);
2844-
goto cleanup;
2850+
continue;
28452851
}
28462852

28472853
/*
@@ -2926,19 +2932,17 @@ static int handle_tx_event(struct xhci_hcd *xhci,
29262932
trb_comp_code))
29272933
xhci_handle_halted_endpoint(xhci, ep, td,
29282934
EP_HARD_RESET);
2929-
goto cleanup;
2930-
}
2931-
2932-
td->status = status;
2935+
} else {
2936+
td->status = status;
29332937

2934-
/* update the urb's actual_length and give back to the core */
2935-
if (usb_endpoint_xfer_control(&td->urb->ep->desc))
2936-
process_ctrl_td(xhci, ep, ep_ring, td, ep_trb, event);
2937-
else if (usb_endpoint_xfer_isoc(&td->urb->ep->desc))
2938-
process_isoc_td(xhci, ep, ep_ring, td, ep_trb, event);
2939-
else
2940-
process_bulk_intr_td(xhci, ep, ep_ring, td, ep_trb, event);
2941-
cleanup:;
2938+
/* update the urb's actual_length and give back to the core */
2939+
if (usb_endpoint_xfer_control(&td->urb->ep->desc))
2940+
process_ctrl_td(xhci, ep, ep_ring, td, ep_trb, event);
2941+
else if (usb_endpoint_xfer_isoc(&td->urb->ep->desc))
2942+
process_isoc_td(xhci, ep, ep_ring, td, ep_trb, event);
2943+
else
2944+
process_bulk_intr_td(xhci, ep, ep_ring, td, ep_trb, event);
2945+
}
29422946
/*
29432947
* If ep->skip is set, it means there are missed tds on the
29442948
* endpoint ring need to take care of.

0 commit comments

Comments
 (0)