]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ShellPkg: BcfgDisplayDump(): accumulate errors
authorLaszlo Ersek <lersek@redhat.com>
Thu, 21 Jan 2016 18:40:05 +0000 (18:40 +0000)
committerlersek <lersek@Edk2>
Thu, 21 Jan 2016 18:40:05 +0000 (18:40 +0000)
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

ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c

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