From d45fd260267ee70c093519eb1e4a1ef285549e85 Mon Sep 17 00:00:00 2001 From: qhuang8 Date: Wed, 17 Sep 2008 13:28:05 +0000 Subject: [PATCH] Fix several code review minor comments: 1.Line 1520, 1525, 1530:Use goto to save Release Lock 2.Line 224: Do not use DEBUG_ERROR, since it is not an error case 3.Scrub the DEBUG () print statement to add DEBUG_PAGE 4.Line 20: Typo of "help cooalese" git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5915 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Core/Dxe/Mem/Page.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/MdeModulePkg/Core/Dxe/Mem/Page.c b/MdeModulePkg/Core/Dxe/Mem/Page.c index b09f2f1304..aeaa48da80 100644 --- a/MdeModulePkg/Core/Dxe/Mem/Page.c +++ b/MdeModulePkg/Core/Dxe/Mem/Page.c @@ -17,7 +17,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #define EFI_DEFAULT_PAGE_ALLOCATION_ALIGNMENT (EFI_PAGE_SIZE) // -// Entry for tracking the memory regions for each memory type to help cooalese like memory types +// Entry for tracking the memory regions for each memory type to coalesce similar memory types // typedef struct { EFI_PHYSICAL_ADDRESS BaseAddress; @@ -221,7 +221,7 @@ PromoteMemoryResource ( LIST_ENTRY *Link; EFI_GCD_MAP_ENTRY *Entry; - DEBUG ((DEBUG_ERROR | DEBUG_PAGE, "Promote the memory resource\n")); + DEBUG ((DEBUG_PAGE, "Promote the memory resource\n")); CoreAcquireGcdMemoryLock (); @@ -754,7 +754,7 @@ CoreConvertPages ( // Debug code - verify conversion is allowed // if (!(NewType == EfiConventionalMemory ? 1 : 0) ^ (Entry->Type == EfiConventionalMemory ? 1 : 0)) { - DEBUG ((DEBUG_ERROR , "ConvertPages: Incompatible memory types\n")); + DEBUG ((DEBUG_ERROR | DEBUG_PAGE, "ConvertPages: Incompatible memory types\n")); return EFI_NOT_FOUND; } @@ -1516,19 +1516,19 @@ CoreTerminateMemoryMap ( Entry = CR(Link, MEMORY_MAP, Link, MEMORY_MAP_SIGNATURE); if (Entry->Attribute & EFI_MEMORY_RUNTIME) { if (Entry->Type == EfiACPIReclaimMemory || Entry->Type == EfiACPIMemoryNVS) { - DEBUG((DEBUG_ERROR, "ExitBootServices: ACPI memory entry has RUNTIME attribute set.\n")); - CoreReleaseMemoryLock (); - return EFI_INVALID_PARAMETER; + DEBUG((DEBUG_ERROR | DEBUG_PAGE, "ExitBootServices: ACPI memory entry has RUNTIME attribute set.\n")); + Status = EFI_INVALID_PARAMETER; + goto Done; } if (Entry->Start & (EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT - 1)) { - DEBUG((DEBUG_ERROR, "ExitBootServices: A RUNTIME memory entry is not on a proper alignment.\n")); - CoreReleaseMemoryLock (); - return EFI_INVALID_PARAMETER; + DEBUG((DEBUG_ERROR | DEBUG_PAGE, "ExitBootServices: A RUNTIME memory entry is not on a proper alignment.\n")); + Status = EFI_INVALID_PARAMETER; + goto Done; } if ((Entry->End + 1) & (EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT - 1)) { - DEBUG((DEBUG_ERROR, "ExitBootServices: A RUNTIME memory entry is not on a proper alignment.\n")); - CoreReleaseMemoryLock (); - return EFI_INVALID_PARAMETER; + DEBUG((DEBUG_ERROR | DEBUG_PAGE, "ExitBootServices: A RUNTIME memory entry is not on a proper alignment.\n")); + Status = EFI_INVALID_PARAMETER; + goto Done; } } } @@ -1544,6 +1544,7 @@ CoreTerminateMemoryMap ( Status = EFI_INVALID_PARAMETER; } +Done: CoreReleaseMemoryLock (); return Status;