diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c index e3d34afc4f..64bfcd336f 100644 --- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c +++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c @@ -2523,7 +2523,16 @@ EfiBootManagerRefreshAllBootOption ( // for (Index = 0; Index < BootOptionCount; Index++) { if (EfiBootManagerFindLoadOption (&BootOptions[Index], NvBootOptions, NvBootOptionCount) == -1) { - EfiBootManagerAddLoadOptionVariable (&BootOptions[Index], (UINTN)-1); + Status = EfiBootManagerAddLoadOptionVariable (&BootOptions[Index], (UINTN)-1); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "[Bds] Failed to add boot option for '%s': %r\n", + BootOptions[Index].Description, + Status + )); + } + // // Try best to add the boot options so continue upon failure. // diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c b/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c index 7813c87cce..76237cca17 100644 --- a/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c +++ b/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c @@ -260,13 +260,13 @@ structure. VariableAttributes = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS; } - Status = gRT->SetVariable ( - OptionName, - &gEfiGlobalVariableGuid, - VariableAttributes, - VariableSize, - Variable - ); + Status = BmSetVariableAndReportStatusCodeOnError ( + OptionName, + &gEfiGlobalVariableGuid, + VariableAttributes, + VariableSize, + Variable + ); FreePool (Variable); return Status; @@ -323,13 +323,13 @@ BmAddOptionNumberToOrderVariable ( NewOptionOrder[Position] = OptionNumber; - Status = gRT->SetVariable ( - OptionOrderName, - &gEfiGlobalVariableGuid, - EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE, - OptionOrderSize + sizeof (UINT16), - NewOptionOrder - ); + Status = BmSetVariableAndReportStatusCodeOnError ( + OptionOrderName, + &gEfiGlobalVariableGuid, + EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE, + OptionOrderSize + sizeof (UINT16), + NewOptionOrder + ); FreePool (NewOptionOrder); }