summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlikun su <sulikun@loongson.cn>2023-08-03 19:08:27 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2023-08-04 01:27:33 +0000
commit01ad4134c3e6339ac53c85fccf62ed10d5b6d662 (patch)
tree811ebc010a0226a1ae3d1dde6e5307595c813954
parentef051451367fa5455d75b38c407ca352a43b4849 (diff)
downloadedk2-01ad4134c3e6339ac53c85fccf62ed10d5b6d662.tar.gz
edk2-01ad4134c3e6339ac53c85fccf62ed10d5b6d662.tar.bz2
edk2-01ad4134c3e6339ac53c85fccf62ed10d5b6d662.zip
MdeModulePkg: Solve boot hang Xhci driver when use USB DVD with empty disk
Signed-off-by: likun su <sulikun@loongson.cn> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: lichao <lichao@loongson.cn> Acked-by: Hao A Wu <hao.a.wu@intel.com>
-rw-r--r--MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
index 298fb88b81..53421e64a8 100644
--- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
+++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
@@ -171,7 +171,6 @@ XhcCreateUrb (
Urb->Context = Context;
Status = XhcCreateTransferTrb (Xhc, Urb);
- ASSERT_EFI_ERROR (Status);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "XhcCreateUrb: XhcCreateTransferTrb Failed, Status = %r\n", Status));
FreePool (Urb);
@@ -247,7 +246,11 @@ XhcCreateTransferTrb (
Dci = XhcEndpointToDci (Urb->Ep.EpAddr, (UINT8)(Urb->Ep.Direction));
ASSERT (Dci < 32);
- EPRing = (TRANSFER_RING *)(UINTN)Xhc->UsbDevContext[SlotId].EndpointTransferRing[Dci-1];
+ EPRing = (TRANSFER_RING *)(UINTN)Xhc->UsbDevContext[SlotId].EndpointTransferRing[Dci-1];
+ if (EPRing == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
Urb->Ring = EPRing;
OutputContext = Xhc->UsbDevContext[SlotId].OutputContext;
if (Xhc->HcCParams.Data.Csz == 0) {