Skip to content

Commit 26dffa4

Browse files
Epicuriusgregkh
authored andcommitted
usb: xhci: replace goto with return when possible in handle_tx_event()
Simplifying the handle_tx_event() function by addressing the complexity of its while loop. Replaces specific 'goto cleanup' statements with 'return' statements, applicable only where 'ep->skip' is set to 'false', ensuring loop termination. The original while loop, combined with 'goto cleanup', adds unnecessary complexity. This change aims to untangle the loop's logic, facilitating a more straightforward review of the upcoming comprehensive 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 ae88758 commit 26dffa4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/usb/host/xhci-ring.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2804,15 +2804,15 @@ static int handle_tx_event(struct xhci_hcd *xhci,
28042804
xhci_handle_halted_endpoint(xhci, ep, NULL,
28052805
EP_HARD_RESET);
28062806
}
2807-
goto cleanup;
2807+
return 0;
28082808
}
28092809

28102810
/* We've skipped all the TDs on the ep ring when ep->skip set */
28112811
if (ep->skip && td_num == 0) {
28122812
ep->skip = false;
28132813
xhci_dbg(xhci, "All tds on the ep_ring skipped. Clear skip flag for slot %u ep %u.\n",
28142814
slot_id, ep_index);
2815-
goto cleanup;
2815+
return 0;
28162816
}
28172817

28182818
td = list_first_entry(&ep_ring->td_list, struct xhci_td,
@@ -2851,7 +2851,7 @@ static int handle_tx_event(struct xhci_hcd *xhci,
28512851
if ((xhci->quirks & XHCI_SPURIOUS_SUCCESS) &&
28522852
ep_ring->last_td_was_short) {
28532853
ep_ring->last_td_was_short = false;
2854-
goto cleanup;
2854+
return 0;
28552855
}
28562856

28572857
/*

0 commit comments

Comments
 (0)