summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuiyu Ni <ruiyu.ni@intel.com>2014-04-28 06:30:14 +0000
committerniruiyu <niruiyu@6f19259b-4bc3-4df7-8a09-765794883524>2014-04-28 06:30:14 +0000
commit1187b10f21de3d6f6e71e98e30c4b20a947e4541 (patch)
tree79f412c200a22a73b8300d6ffe9152e3e06f0f23
parentcd9944d72a2b51004efecdcf024a173721f1b3d1 (diff)
downloadedk2-platforms-1187b10f21de3d6f6e71e98e30c4b20a947e4541.tar.xz
Early return when the "BootOrder" variable doesn't exist to avoid SetVariable() return EFI_NOT_FOUND.
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
-rw-r--r--IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c
index 134833286f..508bd6e9ac 100644
--- a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c
+++ b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c
@@ -521,23 +521,23 @@ BdsDeleteAllInvalidLegacyBootOptions (
return Status;
}
- LegacyBios->GetBbsInfo (
- LegacyBios,
- &HddCount,
- &LocalHddInfo,
- &BbsCount,
- &LocalBbsTable
- );
-
BootOrder = BdsLibGetVariableAndSize (
L"BootOrder",
&gEfiGlobalVariableGuid,
&BootOrderSize
);
if (BootOrder == NULL) {
- BootOrderSize = 0;
+ return EFI_NOT_FOUND;
}
+ LegacyBios->GetBbsInfo (
+ LegacyBios,
+ &HddCount,
+ &LocalHddInfo,
+ &BbsCount,
+ &LocalBbsTable
+ );
+
Index = 0;
while (Index < BootOrderSize / sizeof (UINT16)) {
UnicodeSPrint (BootOption, sizeof (BootOption), L"Boot%04x", BootOrder[Index]);
@@ -634,9 +634,7 @@ BdsDeleteAllInvalidLegacyBootOptions (
// Shrinking variable with existing variable implementation shouldn't fail.
//
ASSERT_EFI_ERROR (Status);
- if (BootOrder != NULL) {
- FreePool (BootOrder);
- }
+ FreePool (BootOrder);
return Status;
}