Revision: 19708
          http://sourceforge.net/p/edk2/code/19708
Author:   lersek
Date:     2016-01-21 18:40:00 +0000 (Thu, 21 Jan 2016)
Log Message:
-----------
ShellPkg: BcfgDisplayDump(): hoist NULL-init of DevPath[String]

It will help with error handling if we move these initializations near the
top of the loop body.

This patch is not supposed to change behavior.

Cc: Jaben Carsey <[email protected]>
Cc: Ryan Harkin <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <[email protected]>
Reviewed-by: Jaben Carsey <[email protected]>

Modified Paths:
--------------
    
trunk/edk2/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c

Modified: 
trunk/edk2/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c
===================================================================
--- 
trunk/edk2/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c   
    2016-01-21 18:39:56 UTC (rev 19707)
+++ 
trunk/edk2/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c   
    2016-01-21 18:40:00 UTC (rev 19708)
@@ -1060,6 +1060,9 @@
   for (LoopVar = 0 ; LoopVar < OrderCount ; LoopVar++) {
     Buffer        = NULL;
     BufferSize    = 0;
+    DevPath       = NULL;
+    DevPathString = NULL;
+
     UnicodeSPrint(VariableName, sizeof(VariableName), L"%s%04x", Op, 
CurrentOrder[LoopVar]);
 
     Status = gRT->GetVariable(
@@ -1085,15 +1088,10 @@
 
     if ((*(UINT16*)(Buffer+4)) != 0) {
       DevPath = AllocateZeroPool(*(UINT16*)(Buffer+4));
-      if (DevPath == NULL) {
-        DevPathString = NULL;
-      } else {
+      if (DevPath != NULL) {
         CopyMem(DevPath, Buffer+6+StrSize((CHAR16*)(Buffer+6)), 
*(UINT16*)(Buffer+4));
         DevPathString = ConvertDevicePathToText(DevPath, TRUE, FALSE);
       }
-    } else {
-      DevPath       = NULL;
-      DevPathString = NULL;
     }
     ShellPrintHiiEx(
       -1,


------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to