public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH v1] usb: xhci: Check return value of wait for TRB_TRANSFER event
@ 2023-10-17  6:20 Minda Chen
  2023-10-17 11:20 ` Marek Vasut
  0 siblings, 1 reply; 10+ messages in thread
From: Minda Chen @ 2023-10-17  6:20 UTC (permalink / raw)
  To: Bin Meng, Marek Vasut; +Cc: u-boot, Minda Chen

xhci_wait_for_event() waiting TRB_TRANSFER event may return
NULL. Checking the return value to avoid crash.

Signed-off-by: Minda Chen <minda.chen@starfivetech.com>
---
 drivers/usb/host/xhci-ring.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index c8260cbdf9..5f02ff0769 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -544,6 +544,8 @@ static void abort_td(struct usb_device *udev, int ep_index)
 	xhci_queue_command(ctrl, 0, udev->slot_id, ep_index, TRB_STOP_RING);
 
 	event = xhci_wait_for_event(ctrl, TRB_TRANSFER);
+	if (!event)
+		return;
 	field = le32_to_cpu(event->trans_event.flags);
 	BUG_ON(TRB_TO_SLOT_ID(field) != udev->slot_id);
 	BUG_ON(TRB_TO_EP_INDEX(field) != ep_index);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-10-19  3:22 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-17  6:20 [PATCH v1] usb: xhci: Check return value of wait for TRB_TRANSFER event Minda Chen
2023-10-17 11:20 ` Marek Vasut
2023-10-18  1:22   ` Minda Chen
2023-10-18  2:35     ` Marek Vasut
2023-10-18  3:46       ` Minda Chen
2023-10-18 10:11         ` Marek Vasut
2023-10-18 10:16           ` Minda Chen
2023-10-18 10:55             ` Marek Vasut
2023-10-19  2:46               ` Minda Chen
2023-10-19  3:22                 ` Marek Vasut

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox