On behalf of Ray. Reviewed-by: Feng Tian <feng.t...@intel.com>

Same again, I will help commit it.

-----Original Message-----
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Michael 
Kinney
Sent: Sunday, December 13, 2015 05:50
To: edk2-devel@lists.01.org
Cc: Ni, Ruiyu; Carsey, Jaben
Subject: [edk2] [Patch] ShellPkg/Mm: Fix build warnings

Fix build warnings for potentially uninitialized local variables in the 
functions ShellMmLocateIoProtocol() and ShellCommandRunMm() in the Shell 
implementation of the 'mm' command.

Cc: Ruiyu Ni <ruiyu...@intel.com>
Cc: Jaben Carsey <jaben.car...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <michael.d.kin...@intel.com>
---
 ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c 
b/ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c
index 3f08cc8..1e2c0cb 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c
@@ -328,6 +328,8 @@ ShellMmLocateIoProtocol (
     return FALSE;
   }
 
+  Segment = 0;
+  Bus     = 0;
   if ((AccessType == ShellMmPci) || (AccessType == ShellMmPciExpress)) {
     ShellMmDecodePciAddress ((BOOLEAN) (AccessType == ShellMmPci), Address, 
&Segment, &Bus, NULL, NULL, NULL);
   }
@@ -614,18 +616,18 @@ ShellCommandRunMm (
         // skip space characters
         //
         for (Index = 0; InputStr[Index] == ' '; Index++);
-      }
 
-      if ((InputStr != NULL) && (InputStr[Index] != CHAR_NULL)) {
-        if ((InputStr[Index] == '.') || (InputStr[Index] == 'q') || 
(InputStr[Index] == 'Q')) {
-          Complete = TRUE;
-        } else if (!EFI_ERROR (ShellConvertStringToUint64 (InputStr + Index, 
&Buffer, TRUE, TRUE)) &&
-                   (Buffer <= mShellMmMaxNumber[Size])
-                   ) {
-          ShellMmAccess (AccessType, PciRootBridgeIo, CpuIo, FALSE, Address, 
Size, &Buffer);
-        } else {
-          ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MM_ERROR), 
gShellDebug1HiiHandle, L"mm");
-          continue;
+        if ((InputStr[Index] != CHAR_NULL)) {
+          if ((InputStr[Index] == '.') || (InputStr[Index] == 'q') || 
(InputStr[Index] == 'Q')) {
+            Complete = TRUE;
+          } else if (!EFI_ERROR (ShellConvertStringToUint64 (InputStr + Index, 
&Buffer, TRUE, TRUE)) &&
+                     (Buffer <= mShellMmMaxNumber[Size])
+                     ) {
+            ShellMmAccess (AccessType, PciRootBridgeIo, CpuIo, FALSE, Address, 
Size, &Buffer);
+          } else {
+            ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MM_ERROR), 
gShellDebug1HiiHandle, L"mm");
+            continue;
+          }
         }
       }
 
--
2.6.3.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to