From c1c2e474a23ab134f93266815a1b4c147b0e9b48 Mon Sep 17 00:00:00 2001 From: Dun Tan Date: Mon, 27 May 2024 17:37:41 +0800 Subject: MdeModulePkg:Remove unneed FreePages for RuntimeHobCacheBuffer Remove unneed FreePages() for RuntimeHobCacheBuffer which is allocated in PEI phase. So the global variable mVariableRuntimeHobCacheBufferSize also can be removed. Signed-off-by: Dun Tan --- .../Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c index 8b42ae7..6808249 100644 --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c @@ -54,7 +54,6 @@ VARIABLE_STORE_HEADER *mVariableRuntimeHobCacheBuffer = NULL; VARIABLE_STORE_HEADER *mVariableRuntimeNvCacheBuffer = NULL; VARIABLE_STORE_HEADER *mVariableRuntimeVolatileCacheBuffer = NULL; UINTN mVariableBufferSize; -UINTN mVariableRuntimeHobCacheBufferSize; UINTN mVariableBufferPayloadSize; BOOLEAN mVariableRuntimeCachePendingUpdate; BOOLEAN mVariableRuntimeCacheReadLock; @@ -578,10 +577,6 @@ CheckForRuntimeCacheSync ( // The HOB variable data may have finished being flushed in the runtime cache sync update // if (mHobFlushComplete && (mVariableRuntimeHobCacheBuffer != NULL)) { - if (!EfiAtRuntime ()) { - FreePages (mVariableRuntimeHobCacheBuffer, EFI_SIZE_TO_PAGES (mVariableRuntimeHobCacheBufferSize)); - } - mVariableRuntimeHobCacheBuffer = NULL; } } @@ -1691,6 +1686,7 @@ SmmVariableReady ( EFI_STATUS Status; UINTN RuntimeNvCacheSize; UINTN RuntimeVolatileCacheSize; + UINTN RuntimeHobCacheBufferSize; Status = gBS->LocateProtocol (&gEfiSmmVariableProtocolGuid, NULL, (VOID **)&mSmmVariable); if (EFI_ERROR (Status)) { @@ -1720,13 +1716,13 @@ SmmVariableReady ( // Allocate runtime variable cache memory buffers. // Status = GetRuntimeCacheInfo ( - &mVariableRuntimeHobCacheBufferSize, + &RuntimeHobCacheBufferSize, &RuntimeNvCacheSize, &RuntimeVolatileCacheSize, &mVariableAuthFormat ); if (!EFI_ERROR (Status)) { - Status = InitVariableCache (&mVariableRuntimeHobCacheBuffer, &mVariableRuntimeHobCacheBufferSize); + Status = InitVariableCache (&mVariableRuntimeHobCacheBuffer, &RuntimeHobCacheBufferSize); if (!EFI_ERROR (Status)) { Status = InitVariableCache (&mVariableRuntimeNvCacheBuffer, &RuntimeNvCacheSize); if (!EFI_ERROR (Status)) { -- cgit v1.1