Skip to content

Commit 1b349f2

Browse files
Epicuriusgregkh
authored andcommitted
usb: xhci: add 'goto' for halted endpoint check in handle_tx_event()
Add 'goto' statement for a halted endpoint, streamlining the error handling process. In future handle_tx_event() changes this 'goto' statement will have more uses. 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 c43e43e commit 1b349f2

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

drivers/usb/host/xhci-ring.c

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2788,10 +2788,9 @@ static int handle_tx_event(struct xhci_hcd *xhci,
27882788
xhci_dbg(xhci, "td_list is empty while skip flag set. Clear skip flag for slot %u ep %u.\n",
27892789
slot_id, ep_index);
27902790
}
2791-
if (xhci_halted_host_endpoint(ep_ctx, trb_comp_code))
2792-
xhci_handle_halted_endpoint(xhci, ep, NULL, EP_HARD_RESET);
27932791

2794-
return 0;
2792+
td = NULL;
2793+
goto check_endpoint_halted;
27952794
}
27962795

27972796
td = list_first_entry(&ep_ring->td_list, struct xhci_td,
@@ -2899,20 +2898,22 @@ static int handle_tx_event(struct xhci_hcd *xhci,
28992898
* indefinitely.
29002899
*/
29012900

2902-
if (trb_is_noop(ep_trb)) {
2903-
if (xhci_halted_host_endpoint(ep_ctx, trb_comp_code))
2904-
xhci_handle_halted_endpoint(xhci, ep, td, EP_HARD_RESET);
2905-
} else {
2906-
td->status = status;
2901+
if (trb_is_noop(ep_trb))
2902+
goto check_endpoint_halted;
29072903

2908-
/* update the urb's actual_length and give back to the core */
2909-
if (usb_endpoint_xfer_control(&td->urb->ep->desc))
2910-
process_ctrl_td(xhci, ep, ep_ring, td, ep_trb, event);
2911-
else if (usb_endpoint_xfer_isoc(&td->urb->ep->desc))
2912-
process_isoc_td(xhci, ep, ep_ring, td, ep_trb, event);
2913-
else
2914-
process_bulk_intr_td(xhci, ep, ep_ring, td, ep_trb, event);
2915-
}
2904+
td->status = status;
2905+
2906+
/* update the urb's actual_length and give back to the core */
2907+
if (usb_endpoint_xfer_control(&td->urb->ep->desc))
2908+
process_ctrl_td(xhci, ep, ep_ring, td, ep_trb, event);
2909+
else if (usb_endpoint_xfer_isoc(&td->urb->ep->desc))
2910+
process_isoc_td(xhci, ep, ep_ring, td, ep_trb, event);
2911+
else
2912+
process_bulk_intr_td(xhci, ep, ep_ring, td, ep_trb, event);
2913+
2914+
check_endpoint_halted:
2915+
if (xhci_halted_host_endpoint(ep_ctx, trb_comp_code))
2916+
xhci_handle_halted_endpoint(xhci, ep, td, EP_HARD_RESET);
29162917

29172918
return 0;
29182919

0 commit comments

Comments
 (0)