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
This commit is contained in:
@ -521,6 +521,15 @@ BdsDeleteAllInvalidLegacyBootOptions (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BootOrder = BdsLibGetVariableAndSize (
|
||||||
|
L"BootOrder",
|
||||||
|
&gEfiGlobalVariableGuid,
|
||||||
|
&BootOrderSize
|
||||||
|
);
|
||||||
|
if (BootOrder == NULL) {
|
||||||
|
return EFI_NOT_FOUND;
|
||||||
|
}
|
||||||
|
|
||||||
LegacyBios->GetBbsInfo (
|
LegacyBios->GetBbsInfo (
|
||||||
LegacyBios,
|
LegacyBios,
|
||||||
&HddCount,
|
&HddCount,
|
||||||
@ -529,15 +538,6 @@ BdsDeleteAllInvalidLegacyBootOptions (
|
|||||||
&LocalBbsTable
|
&LocalBbsTable
|
||||||
);
|
);
|
||||||
|
|
||||||
BootOrder = BdsLibGetVariableAndSize (
|
|
||||||
L"BootOrder",
|
|
||||||
&gEfiGlobalVariableGuid,
|
|
||||||
&BootOrderSize
|
|
||||||
);
|
|
||||||
if (BootOrder == NULL) {
|
|
||||||
BootOrderSize = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
Index = 0;
|
Index = 0;
|
||||||
while (Index < BootOrderSize / sizeof (UINT16)) {
|
while (Index < BootOrderSize / sizeof (UINT16)) {
|
||||||
UnicodeSPrint (BootOption, sizeof (BootOption), L"Boot%04x", BootOrder[Index]);
|
UnicodeSPrint (BootOption, sizeof (BootOption), L"Boot%04x", BootOrder[Index]);
|
||||||
@ -634,9 +634,7 @@ BdsDeleteAllInvalidLegacyBootOptions (
|
|||||||
// Shrinking variable with existing variable implementation shouldn't fail.
|
// Shrinking variable with existing variable implementation shouldn't fail.
|
||||||
//
|
//
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
if (BootOrder != NULL) {
|
|
||||||
FreePool (BootOrder);
|
FreePool (BootOrder);
|
||||||
}
|
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user