Commit 1b349f21 authored by Niklas Neronin's avatar Niklas Neronin Committed by Greg Kroah-Hartman
Browse files

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: default avatarNiklas Neronin <niklas.neronin@linux.intel.com>
Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
Link: https://lore.kernel.org/r/20240626124835.1023046-20-mathias.nyman@linux.intel.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c43e43e8
Loading
Loading
Loading
Loading
+17 −16
Original line number Diff line number Diff line
@@ -2788,10 +2788,9 @@ static int handle_tx_event(struct xhci_hcd *xhci,
				xhci_dbg(xhci, "td_list is empty while skip flag set. Clear skip flag for slot %u ep %u.\n",
					 slot_id, ep_index);
			}
			if (xhci_halted_host_endpoint(ep_ctx, trb_comp_code))
				xhci_handle_halted_endpoint(xhci, ep, NULL, EP_HARD_RESET);

			return 0;
			td = NULL;
			goto check_endpoint_halted;
		}

		td = list_first_entry(&ep_ring->td_list, struct xhci_td,
@@ -2899,10 +2898,9 @@ static int handle_tx_event(struct xhci_hcd *xhci,
	 * indefinitely.
	 */

	if (trb_is_noop(ep_trb)) {
		if (xhci_halted_host_endpoint(ep_ctx, trb_comp_code))
			xhci_handle_halted_endpoint(xhci, ep, td, EP_HARD_RESET);
	} else {
	if (trb_is_noop(ep_trb))
		goto check_endpoint_halted;

	td->status = status;

	/* update the urb's actual_length and give back to the core */
@@ -2912,7 +2910,10 @@ static int handle_tx_event(struct xhci_hcd *xhci,
		process_isoc_td(xhci, ep, ep_ring, td, ep_trb, event);
	else
		process_bulk_intr_td(xhci, ep, ep_ring, td, ep_trb, event);
	}

check_endpoint_halted:
	if (xhci_halted_host_endpoint(ep_ctx, trb_comp_code))
		xhci_handle_halted_endpoint(xhci, ep, td, EP_HARD_RESET);

	return 0;