If Bds launches BootNext with failure, delete it.

Otherwise, we'll create BootNext variable by BdsStartOption() & delete
it in BdsEntry() for each boot. It doesn't make sense to update
this variable in non-volatile variable area for each boot. And the
non-volatile variable area may be full of this message until overflow.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Haojian Zhuang <haojian.zhu...@linaro.org>
---
 ArmPlatformPkg/Bds/Bds.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/ArmPlatformPkg/Bds/Bds.c b/ArmPlatformPkg/Bds/Bds.c
index ffae4bc..512e8e1 100644
--- a/ArmPlatformPkg/Bds/Bds.c
+++ b/ArmPlatformPkg/Bds/Bds.c
@@ -530,12 +530,12 @@ BdsEntry (
       // BootNext has not been succeeded launched
       if (EFI_ERROR(Status)) {
         Print(L"Fail to start BootNext.\n");
-      }
 
-      // Delete the BootNext environment variable
-      gRT->SetVariable (L"BootNext", &gEfiGlobalVariableGuid,
-          EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | 
EFI_VARIABLE_RUNTIME_ACCESS,
-          0, NULL);
+        // Delete the BootNext environment variable
+        gRT->SetVariable (L"BootNext", &gEfiGlobalVariableGuid,
+            EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | 
EFI_VARIABLE_RUNTIME_ACCESS,
+            0, NULL);
+      }
     }
 
     // Clear BootCurrent variable
-- 
2.1.4

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to