diff options
author | Dandan Bi <dandan.bi@intel.com> | 2016-03-09 11:11:52 +0800 |
---|---|---|
committer | Feng Tian <feng.tian@intel.com> | 2016-03-16 10:42:03 +0800 |
commit | 1b53320e9e7a2d036796b0280d5ec52a004b2ca7 (patch) | |
tree | 835631d299f8d1973d7b7ab5e88e3c7d6f563bf6 /IntelFrameworkModulePkg | |
parent | c7d310dd169ef84eee1ffab3af763372a363ab4b (diff) | |
download | edk2-platforms-1b53320e9e7a2d036796b0280d5ec52a004b2ca7.tar.xz |
IntelFrameworkModulePkg/LegacyBootMaintUiLib: Refine the code
Remove the ASSERT code that may be triggered in LegacyBootMaintUiLib.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Diffstat (limited to 'IntelFrameworkModulePkg')
-rw-r--r-- | IntelFrameworkModulePkg/Library/LegacyBootMaintUiLib/LegacyBootMaintUi.c | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/IntelFrameworkModulePkg/Library/LegacyBootMaintUiLib/LegacyBootMaintUi.c b/IntelFrameworkModulePkg/Library/LegacyBootMaintUiLib/LegacyBootMaintUi.c index 65d617cf38..c9d6ee4d1b 100644 --- a/IntelFrameworkModulePkg/Library/LegacyBootMaintUiLib/LegacyBootMaintUi.c +++ b/IntelFrameworkModulePkg/Library/LegacyBootMaintUiLib/LegacyBootMaintUi.c @@ -1,7 +1,7 @@ /** @file
Legacy Boot Maintainence UI implementation.
-Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -109,8 +109,11 @@ HII_VENDOR_DEVICE_PATH mLegacyBootOptionHiiVendorDevicePath = { @param EnBootOptionCount Count of the enabled Boot Option Numbers
@param DisBootOption Callee allocated buffer containing the disabled Boot Option Numbers
@param DisBootOptionCount Count of the disabled Boot Option Numbers
+
+ @return EFI_SUCCESS The function completed successfully.
+ @retval other Contain some error, details see the status return by gRT->SetVariable.
**/
-VOID
+EFI_STATUS
OrderLegacyBootOption4SameType (
UINT16 *DevOrder,
UINTN DevOrderCount,
@@ -143,6 +146,7 @@ OrderLegacyBootOption4SameType ( *DisBootOptionCount = 0;
*EnBootOptionCount = 0;
Index = 0;
+ Status = EFI_SUCCESS;
ASSERT (BbsIndexArray != NULL);
ASSERT (DeviceTypeArray != NULL);
@@ -207,11 +211,12 @@ OrderLegacyBootOption4SameType ( BootOrderSize,
BootOrder
);
- ASSERT_EFI_ERROR (Status);
FreePool (NewBootOption);
FreePool (DeviceTypeArray);
FreePool (BbsIndexArray);
+
+ return Status;
}
/**
@@ -222,8 +227,9 @@ OrderLegacyBootOption4SameType ( @param NVMapData The data for egacy BBS boot.
@return EFI_SUCCESS The function completed successfully.
- @retval EFI_NOT_FOUND If L"LegacyDevOrder" and gEfiLegacyDevOrderVariableGuid EFI Variable can be found.
+ @retval EFI_NOT_FOUND If L"LegacyDevOrder" and gEfiLegacyDevOrderVariableGuid EFI Variable can not be found.
@retval EFI_OUT_OF_RESOURCES Fail to allocate memory resource
+ @retval other Contain some error, details see the status return by gRT->SetVariable.
**/
EFI_STATUS
UpdateBBSOption (
@@ -260,6 +266,8 @@ UpdateBBSOption ( DisMap = NULL;
NewOrder = NULL;
CurrentType = 0;
+ EnBootOption = NULL;
+ DisBootOption = NULL;
DisMap = mLegacyBootOptionPrivate->MaintainMapData->DisableMap;
@@ -381,7 +389,7 @@ UpdateBBSOption ( //
ASSERT (OptionMenu->MenuNumber == DevOrder->Length / sizeof (UINT16) - 1);
- OrderLegacyBootOption4SameType (
+ Status = OrderLegacyBootOption4SameType (
DevOrder->Data,
DevOrder->Length / sizeof (UINT16) - 1,
&EnBootOption,
@@ -389,6 +397,9 @@ UpdateBBSOption ( &DisBootOption,
&DisBootOptionCount
);
+ if (EFI_ERROR(Status)) {
+ goto Fail;
+ }
//
// 2. Deactivate the DisBootOption and activate the EnBootOption
@@ -446,6 +457,15 @@ UpdateBBSOption ( OriginalPtr
);
+Fail:
+ if (EnBootOption != NULL) {
+ FreePool (EnBootOption);
+ }
+
+ if (DisBootOption != NULL) {
+ FreePool (DisBootOption);
+ }
+
FreePool (OriginalPtr);
return Status;
}
|