diff mbox

[edk2,v2,06/15] OvmfPkg: PciHostBridgeLib: implement PciHostBridgeFreeRootBridges()

Message ID 1457000154-23081-7-git-send-email-lersek@redhat.com
State Accepted
Commit dc4d64670a19d4f813e8f3dc7231998615404511
Headers show

Commit Message

Laszlo Ersek March 3, 2016, 10:15 a.m. UTC
This function has no counterpart in OvmfPkg/PciHostBridgeDxe/, but the
PciHostBridgeLib class requires it.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Marcel Apfelbaum <marcel@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>

---
 OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

-- 
1.8.3.1


_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
diff mbox

Patch

diff --git a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
index 2f22d637ae26..25746dd1cfd0 100644
--- a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
+++ b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
@@ -215,7 +215,17 @@  PciHostBridgeFreeRootBridges (
   UINTN           Count
   )
 {
-  return;
+  if (Bridges == NULL && Count == 0) {
+    return;
+  }
+  ASSERT (Bridges != NULL && Count > 0);
+
+  do {
+    --Count;
+    UninitRootBridge (&Bridges[Count]);
+  } while (Count > 0);
+
+  FreePool (Bridges);
 }