From: Laszlo Ersek Date: Thu, 21 Jan 2016 18:40:05 +0000 (+0000) Subject: ShellPkg: BcfgDisplayDump(): accumulate errors X-Git-Tag: edk2-stable201903~7987 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=8f2c09f8b2a8708db49e42bcac4cdfbccfa817d8 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 Cc: Ryan Harkin Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek Reviewed-by: Jaben Carsey git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19709 6f19259b-4bc3-4df7-8a09-765794883524 --- 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; } /**