From: Laszlo Ersek Date: Mon, 25 Jan 2016 22:17:22 +0000 (+0100) Subject: OvmfPkg: PciHostBridgeLib: implement PciHostBridgeFreeRootBridges() X-Git-Tag: edk2-stable201903~7723 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=dc4d64670a19d4f813e8f3dc7231998615404511 OvmfPkg: PciHostBridgeLib: implement PciHostBridgeFreeRootBridges() This function has no counterpart in OvmfPkg/PciHostBridgeDxe/, but the PciHostBridgeLib class requires it. Cc: Jordan Justen Cc: Ruiyu Ni Cc: Marcel Apfelbaum Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek Reviewed-by: Jordan Justen --- diff --git a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c index 2f22d637ae..25746dd1cf 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); }