diff options
-rw-r--r-- | MdeModulePkg/Bus/Pci/EhciDxe/EhciSched.c | 7 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Pci/EhciDxe/UsbHcMem.c | 4 |
2 files changed, 8 insertions, 3 deletions
diff --git a/MdeModulePkg/Bus/Pci/EhciDxe/EhciSched.c b/MdeModulePkg/Bus/Pci/EhciDxe/EhciSched.c index d2e53300af..58d4a303dc 100644 --- a/MdeModulePkg/Bus/Pci/EhciDxe/EhciSched.c +++ b/MdeModulePkg/Bus/Pci/EhciDxe/EhciSched.c @@ -74,6 +74,7 @@ EhcCreateHelpQ ( QhHw->HorizonLink = QH_LINK (PciAddr + OFFSET_OF(EHC_QH, QhHw), EHC_TYPE_QH, FALSE);
QhHw->Status = QTD_STAT_HALTED;
QhHw->ReclaimHead = 1;
+ Qh->NextQh = Qh;
Ehc->ReclaimHead = Qh;
//
@@ -335,9 +336,9 @@ EhcLinkQhToAsync ( Qh->NextQh = Head->NextQh;
Head->NextQh = Qh;
- PciAddr = UsbHcGetPciAddressForHostMem (Ehc->MemPool, Head, sizeof (EHC_QH));
+ PciAddr = UsbHcGetPciAddressForHostMem (Ehc->MemPool, Qh->NextQh, sizeof (EHC_QH));
Qh->QhHw.HorizonLink = QH_LINK (PciAddr, EHC_TYPE_QH, FALSE);
- PciAddr = UsbHcGetPciAddressForHostMem (Ehc->MemPool, Qh, sizeof (EHC_QH));
+ PciAddr = UsbHcGetPciAddressForHostMem (Ehc->MemPool, Head->NextQh, sizeof (EHC_QH));
Head->QhHw.HorizonLink = QH_LINK (PciAddr, EHC_TYPE_QH, FALSE);
}
@@ -372,7 +373,7 @@ EhcUnlinkQhFromAsync ( Head->NextQh = Qh->NextQh;
Qh->NextQh = NULL;
- PciAddr = UsbHcGetPciAddressForHostMem (Ehc->MemPool, Head, sizeof (EHC_QH));
+ PciAddr = UsbHcGetPciAddressForHostMem (Ehc->MemPool, Head->NextQh, sizeof (EHC_QH));
Head->QhHw.HorizonLink = QH_LINK (PciAddr, EHC_TYPE_QH, FALSE);
//
diff --git a/MdeModulePkg/Bus/Pci/EhciDxe/UsbHcMem.c b/MdeModulePkg/Bus/Pci/EhciDxe/UsbHcMem.c index 5194d540a7..536d8ad8e6 100644 --- a/MdeModulePkg/Bus/Pci/EhciDxe/UsbHcMem.c +++ b/MdeModulePkg/Bus/Pci/EhciDxe/UsbHcMem.c @@ -246,6 +246,10 @@ UsbHcGetPciAddressForHostMem ( Head = Pool->Head;
AllocSize = USBHC_MEM_ROUND (Size);
+ if (Mem == NULL) {
+ return 0;
+ }
+
for (Block = Head; Block != NULL; Block = Block->Next) {
//
// scan the memory block list for the memory block that
|