MdeModulePkg:Fix the issue that Commit changes and Exit fail when add driver option

When add driver option using file,input the description and then commit changes and exit,
it doesn't work.it caused by the commit 18216.When variable DriverOrderList in Variable.c
is NULL,it also need do the follow path,shouldn't return.Now change the code.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18220 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Dandan Bi 2015-08-14 01:06:48 +00:00 committed by dandanbi
parent 1abfa4ce48
commit d6da3fb0b2
1 changed files with 8 additions and 12 deletions

View File

@ -524,7 +524,6 @@ Var_UpdateErrorOutOption (
@retval EFI_OUT_OF_RESOURCES If not enought memory to complete the operation.
@retval EFI_SUCCESS If function completes successfully.
@return Others Errors Return errors from call to gRT->GetVariable.
**/
EFI_STATUS
@ -660,13 +659,12 @@ Var_UpdateDriverOption (
Buffer
);
ASSERT_EFI_ERROR (Status);
Status = GetEfiGlobalVariable2 (L"DriverOrder", (VOID **) &DriverOrderList, &DriverOrderListSize);
if (EFI_ERROR (Status) || DriverOrderList == NULL){
return Status;
}
GetEfiGlobalVariable2 (L"DriverOrder", (VOID **) &DriverOrderList, &DriverOrderListSize);
NewDriverOrderList = AllocateZeroPool (DriverOrderListSize + sizeof (UINT16));
ASSERT (NewDriverOrderList != NULL);
CopyMem (NewDriverOrderList, DriverOrderList, DriverOrderListSize);
if (DriverOrderList != NULL){
CopyMem (NewDriverOrderList, DriverOrderList, DriverOrderListSize);
}
NewDriverOrderList[DriverOrderListSize / sizeof (UINT16)] = Index;
if (DriverOrderList != NULL) {
EfiLibDeleteVariable (L"DriverOrder", &gEfiGlobalVariableGuid);
@ -704,7 +702,6 @@ Var_UpdateDriverOption (
@retval EFI_OUT_OF_RESOURCES If not enought memory to complete the operation.
@retval EFI_SUCCESS If function completes successfully.
@return Others Errors Return errors from call to gRT->GetVariable.
**/
EFI_STATUS
@ -829,13 +826,12 @@ Var_UpdateBootOption (
);
ASSERT_EFI_ERROR (Status);
Status = GetEfiGlobalVariable2 (L"BootOrder", (VOID **) &BootOrderList, &BootOrderListSize);
if (EFI_ERROR (Status) || BootOrderList == NULL){
return Status;
}
GetEfiGlobalVariable2 (L"BootOrder", (VOID **) &BootOrderList, &BootOrderListSize);
NewBootOrderList = AllocateZeroPool (BootOrderListSize + sizeof (UINT16));
ASSERT (NewBootOrderList != NULL);
CopyMem (NewBootOrderList, BootOrderList, BootOrderListSize);
if (BootOrderList != NULL){
CopyMem (NewBootOrderList, BootOrderList, BootOrderListSize);
}
NewBootOrderList[BootOrderListSize / sizeof (UINT16)] = Index;
if (BootOrderList != NULL) {