ShellPkg: BcfgDisplayDump(): accumulate errors

Don't exit the command immediately when a variable access fails; continue
processing after printing the error message. Let the final return status
reflect any encountered errors.

This patch is intended as a functional improvement.

Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Ryan Harkin <ryan.harkin@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19709 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Laszlo Ersek 2016-01-21 18:40:05 +00:00 committed by lersek
parent 43da602cb4
commit 8f2c09f8b2
1 changed files with 7 additions and 2 deletions

View File

@ -1051,12 +1051,15 @@ BcfgDisplayDump(
UINTN LoopVar2; UINTN LoopVar2;
CHAR16 *DevPathString; CHAR16 *DevPathString;
VOID *DevPath; VOID *DevPath;
UINTN Errors;
if (OrderCount == 0) { if (OrderCount == 0) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_BCFG_NONE), gShellBcfgHiiHandle, L"bcfg"); ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_BCFG_NONE), gShellBcfgHiiHandle, L"bcfg");
return (SHELL_SUCCESS); return (SHELL_SUCCESS);
} }
Errors = 0;
for (LoopVar = 0 ; LoopVar < OrderCount ; LoopVar++) { for (LoopVar = 0 ; LoopVar < OrderCount ; LoopVar++) {
Buffer = NULL; Buffer = NULL;
BufferSize = 0; BufferSize = 0;
@ -1083,7 +1086,8 @@ BcfgDisplayDump(
if (EFI_ERROR(Status) || Buffer == NULL) { if (EFI_ERROR(Status) || Buffer == NULL) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_READ_FAIL), gShellBcfgHiiHandle, L"bcfg", VariableName); 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) { if ((*(UINT16*)(Buffer+4)) != 0) {
@ -1120,6 +1124,7 @@ BcfgDisplayDump(
L"\r\n"); L"\r\n");
} }
Cleanup:
if (Buffer != NULL) { if (Buffer != NULL) {
FreePool(Buffer); FreePool(Buffer);
} }
@ -1130,7 +1135,7 @@ BcfgDisplayDump(
FreePool(DevPathString); FreePool(DevPathString);
} }
} }
return (SHELL_SUCCESS); return (Errors > 0) ? SHELL_INVALID_PARAMETER : SHELL_SUCCESS;
} }
/** /**