diff --git a/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c b/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c index f5ae7bc0d9..36d04d495c 100644 --- a/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c +++ b/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c @@ -1051,12 +1051,15 @@ BcfgDisplayDump( UINTN LoopVar2; CHAR16 *DevPathString; VOID *DevPath; + UINTN Errors; if (OrderCount == 0) { ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_BCFG_NONE), gShellBcfgHiiHandle, L"bcfg"); return (SHELL_SUCCESS); } + Errors = 0; + for (LoopVar = 0 ; LoopVar < OrderCount ; LoopVar++) { Buffer = NULL; BufferSize = 0; @@ -1083,7 +1086,8 @@ BcfgDisplayDump( if (EFI_ERROR(Status) || Buffer == NULL) { ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_READ_FAIL), gShellBcfgHiiHandle, L"bcfg", VariableName); - return (SHELL_INVALID_PARAMETER); + ++Errors; + goto Cleanup; } if ((*(UINT16*)(Buffer+4)) != 0) { @@ -1120,6 +1124,7 @@ BcfgDisplayDump( L"\r\n"); } +Cleanup: if (Buffer != NULL) { FreePool(Buffer); } @@ -1130,7 +1135,7 @@ BcfgDisplayDump( FreePool(DevPathString); } } - return (SHELL_SUCCESS); + return (Errors > 0) ? SHELL_INVALID_PARAMETER : SHELL_SUCCESS; } /**