System will hang at debug print if enter RecordVarErrorFlag
in runtime.

This patch fix hang issue when run fwts in OS:
fwts uefirtmisc

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ming Huang <ming.hua...@outlook.com>
---
 MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c 
b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
index d23aea4bc712..40efa10839ad 100644
--- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
+++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
@@ -278,18 +278,16 @@ RecordVarErrorFlag (
   VAR_ERROR_FLAG            *VarErrFlag;
   VAR_ERROR_FLAG            TempFlag;
 
-  DEBUG_CODE (
-    DEBUG ((EFI_D_ERROR, "RecordVarErrorFlag (0x%02x) %s:%g - 0x%08x - 
0x%x\n", Flag, VariableName, VendorGuid, Attributes, VariableSize));
-    if (Flag == VAR_ERROR_FLAG_SYSTEM_ERROR) {
-      if (AtRuntime ()) {
-        DEBUG ((EFI_D_ERROR, "CommonRuntimeVariableSpace = 0x%x - 
CommonVariableTotalSize = 0x%x\n", 
mVariableModuleGlobal->CommonRuntimeVariableSpace, 
mVariableModuleGlobal->CommonVariableTotalSize));
-      } else {
+  if (!AtRuntime ()) {
+    DEBUG_CODE (
+      DEBUG ((EFI_D_ERROR, "RecordVarErrorFlag (0x%02x) %s:%g - 0x%08x - 
0x%x\n", Flag, VariableName, VendorGuid, Attributes, VariableSize));
+      if (Flag == VAR_ERROR_FLAG_SYSTEM_ERROR) {
         DEBUG ((EFI_D_ERROR, "CommonVariableSpace = 0x%x - 
CommonVariableTotalSize = 0x%x\n", mVariableModuleGlobal->CommonVariableSpace, 
mVariableModuleGlobal->CommonVariableTotalSize));
+      } else {
+        DEBUG ((EFI_D_ERROR, "CommonMaxUserVariableSpace = 0x%x - 
CommonUserVariableTotalSize = 0x%x\n", 
mVariableModuleGlobal->CommonMaxUserVariableSpace, 
mVariableModuleGlobal->CommonUserVariableTotalSize));
       }
-    } else {
-      DEBUG ((EFI_D_ERROR, "CommonMaxUserVariableSpace = 0x%x - 
CommonUserVariableTotalSize = 0x%x\n", 
mVariableModuleGlobal->CommonMaxUserVariableSpace, 
mVariableModuleGlobal->CommonUserVariableTotalSize));
-    }
-  );
+    );
+  }
 
   if (!mEndOfDxe) {
     //
-- 
2.9.5


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#55353): https://edk2.groups.io/g/devel/message/55353
Mute This Topic: https://groups.io/mt/71717823/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to