summaryrefslogtreecommitdiff
path: root/ArmPkg
diff options
context:
space:
mode:
authoroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>2012-07-04 20:21:13 +0000
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>2012-07-04 20:21:13 +0000
commit7422411e38523446c3d0e6b37bfbaaf90d8726f7 (patch)
treeba06523d10ab91f7b3f5b02364aa7705d9ba0e24 /ArmPkg
parent8cfd2e24578ea90e3152c4167df6889edeb33730 (diff)
downloadedk2-platforms-7422411e38523446c3d0e6b37bfbaaf90d8726f7.tar.xz
ArmPkg/BdsLib: Fixed ShutdownUefiBootServices() in case the first gBS->GetMemoryMap() was successful
If the first call of gBS->GetMemoryMap() succeeded (could happen if the Memory Map has changed between the two gBS->GetMemoryMap() calls) in the loop block then gBS->ExitBootServices() was never called. Signed-off-by: Eugene Cohen <eugene@hp.com> Reviewed-by: Olivier Martin <olivier.martin@arm.com> git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13500 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ArmPkg')
-rw-r--r--ArmPkg/Library/BdsLib/BdsHelper.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/ArmPkg/Library/BdsLib/BdsHelper.c b/ArmPkg/Library/BdsLib/BdsHelper.c
index d971a76b71..bd1fa005e8 100644
--- a/ArmPkg/Library/BdsLib/BdsHelper.c
+++ b/ArmPkg/Library/BdsLib/BdsHelper.c
@@ -43,6 +43,7 @@ ShutdownUefiBootServices (
MemoryMap = NULL;
MemoryMapSize = 0;
+ Pages = 0;
do {
Status = gBS->GetMemoryMap (
&MemoryMapSize,
@@ -66,17 +67,18 @@ ShutdownUefiBootServices (
&DescriptorSize,
&DescriptorVersion
);
- // Don't do anything between the GetMemoryMap() and ExitBootServices()
- if (!EFI_ERROR (Status)) {
- Status = gBS->ExitBootServices (gImageHandle, MapKey);
- if (EFI_ERROR (Status)) {
- FreePages (MemoryMap, Pages);
- MemoryMap = NULL;
- MemoryMapSize = 0;
- }
+ }
+
+ // Don't do anything between the GetMemoryMap() and ExitBootServices()
+ if (!EFI_ERROR(Status)) {
+ Status = gBS->ExitBootServices (gImageHandle, MapKey);
+ if (EFI_ERROR(Status)) {
+ FreePages (MemoryMap, Pages);
+ MemoryMap = NULL;
+ MemoryMapSize = 0;
}
}
- } while (EFI_ERROR (Status));
+ } while (EFI_ERROR(Status));
return Status;
}