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 <dun.tan@intel.com>
This commit is contained in:
Dun Tan 2024-05-27 17:37:41 +08:00 committed by mergify[bot]
parent 645d9f6f8d
commit c1c2e474a2

View File

@ -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)) {