MdeModulePkg:Remove unnecessary global variables

Remove the two unnecessary global variables and
replace them by two local variables:
  mVariableRuntimeNvCacheBufferSize
  mVariableRuntimeVolatileCacheBufferSize

Signed-off-by: Dun Tan <dun.tan@intel.com>
This commit is contained in:
Dun Tan 2024-05-14 12:13:15 +08:00 committed by mergify[bot]
parent d8f513de3e
commit 645d9f6f8d
1 changed files with 7 additions and 7 deletions

View File

@ -13,7 +13,7 @@
InitCommunicateBuffer() is really function to check the variable data size. InitCommunicateBuffer() is really function to check the variable data size.
Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.<BR> Copyright (c) 2010 - 2024, Intel Corporation. All rights reserved.<BR>
Copyright (c) Microsoft Corporation.<BR> Copyright (c) Microsoft Corporation.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent SPDX-License-Identifier: BSD-2-Clause-Patent
@ -55,8 +55,6 @@ VARIABLE_STORE_HEADER *mVariableRuntimeNvCacheBuffer = NULL;
VARIABLE_STORE_HEADER *mVariableRuntimeVolatileCacheBuffer = NULL; VARIABLE_STORE_HEADER *mVariableRuntimeVolatileCacheBuffer = NULL;
UINTN mVariableBufferSize; UINTN mVariableBufferSize;
UINTN mVariableRuntimeHobCacheBufferSize; UINTN mVariableRuntimeHobCacheBufferSize;
UINTN mVariableRuntimeNvCacheBufferSize;
UINTN mVariableRuntimeVolatileCacheBufferSize;
UINTN mVariableBufferPayloadSize; UINTN mVariableBufferPayloadSize;
BOOLEAN mVariableRuntimeCachePendingUpdate; BOOLEAN mVariableRuntimeCachePendingUpdate;
BOOLEAN mVariableRuntimeCacheReadLock; BOOLEAN mVariableRuntimeCacheReadLock;
@ -1691,6 +1689,8 @@ SmmVariableReady (
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
UINTN RuntimeNvCacheSize;
UINTN RuntimeVolatileCacheSize;
Status = gBS->LocateProtocol (&gEfiSmmVariableProtocolGuid, NULL, (VOID **)&mSmmVariable); Status = gBS->LocateProtocol (&gEfiSmmVariableProtocolGuid, NULL, (VOID **)&mSmmVariable);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
@ -1721,16 +1721,16 @@ SmmVariableReady (
// //
Status = GetRuntimeCacheInfo ( Status = GetRuntimeCacheInfo (
&mVariableRuntimeHobCacheBufferSize, &mVariableRuntimeHobCacheBufferSize,
&mVariableRuntimeNvCacheBufferSize, &RuntimeNvCacheSize,
&mVariableRuntimeVolatileCacheBufferSize, &RuntimeVolatileCacheSize,
&mVariableAuthFormat &mVariableAuthFormat
); );
if (!EFI_ERROR (Status)) { if (!EFI_ERROR (Status)) {
Status = InitVariableCache (&mVariableRuntimeHobCacheBuffer, &mVariableRuntimeHobCacheBufferSize); Status = InitVariableCache (&mVariableRuntimeHobCacheBuffer, &mVariableRuntimeHobCacheBufferSize);
if (!EFI_ERROR (Status)) { if (!EFI_ERROR (Status)) {
Status = InitVariableCache (&mVariableRuntimeNvCacheBuffer, &mVariableRuntimeNvCacheBufferSize); Status = InitVariableCache (&mVariableRuntimeNvCacheBuffer, &RuntimeNvCacheSize);
if (!EFI_ERROR (Status)) { if (!EFI_ERROR (Status)) {
Status = InitVariableCache (&mVariableRuntimeVolatileCacheBuffer, &mVariableRuntimeVolatileCacheBufferSize); Status = InitVariableCache (&mVariableRuntimeVolatileCacheBuffer, &RuntimeVolatileCacheSize);
if (!EFI_ERROR (Status)) { if (!EFI_ERROR (Status)) {
Status = SendRuntimeVariableCacheContextToSmm (); Status = SendRuntimeVariableCacheContextToSmm ();
if (!EFI_ERROR (Status)) { if (!EFI_ERROR (Status)) {