]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Early return when the "BootOrder" variable doesn't exist to avoid SetVariable() retur...
authorRuiyu Ni <ruiyu.ni@intel.com>
Mon, 28 Apr 2014 06:30:14 +0000 (06:30 +0000)
committerniruiyu <niruiyu@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 28 Apr 2014 06:30:14 +0000 (06:30 +0000)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15489 6f19259b-4bc3-4df7-8a09-765794883524

IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c

index 134833286fcc8933d252e129ca8aaa7d9660d8ed..508bd6e9acc93a4bd084070e51c16a4d00e6c990 100644 (file)
@@ -521,23 +521,23 @@ BdsDeleteAllInvalidLegacyBootOptions (
     return Status;\r
   }\r
 \r
-  LegacyBios->GetBbsInfo (\r
-                LegacyBios,\r
-                &HddCount,\r
-                &LocalHddInfo,\r
-                &BbsCount,\r
-                &LocalBbsTable\r
-                );\r
-\r
   BootOrder = BdsLibGetVariableAndSize (\r
                 L"BootOrder",\r
                 &gEfiGlobalVariableGuid,\r
                 &BootOrderSize\r
                 );\r
   if (BootOrder == NULL) {\r
-    BootOrderSize = 0;\r
+    return EFI_NOT_FOUND;\r
   }\r
 \r
+  LegacyBios->GetBbsInfo (\r
+                LegacyBios,\r
+                &HddCount,\r
+                &LocalHddInfo,\r
+                &BbsCount,\r
+                &LocalBbsTable\r
+                );\r
+\r
   Index = 0;\r
   while (Index < BootOrderSize / sizeof (UINT16)) {\r
     UnicodeSPrint (BootOption, sizeof (BootOption), L"Boot%04x", BootOrder[Index]);\r
@@ -634,9 +634,7 @@ BdsDeleteAllInvalidLegacyBootOptions (
   // Shrinking variable with existing variable implementation shouldn't fail.\r
   //\r
   ASSERT_EFI_ERROR (Status);\r
-  if (BootOrder != NULL) {\r
-    FreePool (BootOrder);\r
-  }\r
+  FreePool (BootOrder);\r
 \r
   return Status;\r
 }\r