]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ShellPkg/Mm: Fix build warnings
authorMichael Kinney <michael.d.kinney@intel.com>
Mon, 14 Dec 2015 06:03:58 +0000 (06:03 +0000)
committererictian <erictian@Edk2>
Mon, 14 Dec 2015 06:03:58 +0000 (06:03 +0000)
Fix build warnings for potentially uninitialized local variables
in the functions ShellMmLocateIoProtocol() and ShellCommandRunMm()
in the Shell implementation of the 'mm' command.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19233 6f19259b-4bc3-4df7-8a09-765794883524

ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c

index 7b26e4d27f6e3eb3250a91c029b88302eb4a8c52..26a758b6cdd75f2379a3a7da11b9ffe9250c4372 100644 (file)
@@ -329,6 +329,8 @@ ShellMmLocateIoProtocol (
     return FALSE;\r
   }\r
 \r
+  Segment = 0;\r
+  Bus     = 0;\r
   if ((AccessType == ShellMmPci) || (AccessType == ShellMmPciExpress)) {\r
     ShellMmDecodePciAddress ((BOOLEAN) (AccessType == ShellMmPci), Address, &Segment, &Bus, NULL, NULL, NULL);\r
   }\r
@@ -615,18 +617,18 @@ ShellCommandRunMm (
         // skip space characters\r
         //\r
         for (Index = 0; InputStr[Index] == ' '; Index++);\r
-      }\r
 \r
-      if ((InputStr != NULL) && (InputStr[Index] != CHAR_NULL)) {\r
-        if ((InputStr[Index] == '.') || (InputStr[Index] == 'q') || (InputStr[Index] == 'Q')) {\r
-          Complete = TRUE;\r
-        } else if (!EFI_ERROR (ShellConvertStringToUint64 (InputStr + Index, &Buffer, TRUE, TRUE)) &&\r
-                   (Buffer <= mShellMmMaxNumber[Size])\r
-                   ) {\r
-          ShellMmAccess (AccessType, PciRootBridgeIo, CpuIo, FALSE, Address, Size, &Buffer);\r
-        } else {\r
-          ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MM_ERROR), gShellDebug1HiiHandle, L"mm");\r
-          continue;\r
+        if (InputStr[Index] != CHAR_NULL) {\r
+          if ((InputStr[Index] == '.') || (InputStr[Index] == 'q') || (InputStr[Index] == 'Q')) {\r
+            Complete = TRUE;\r
+          } else if (!EFI_ERROR (ShellConvertStringToUint64 (InputStr + Index, &Buffer, TRUE, TRUE)) &&\r
+                     (Buffer <= mShellMmMaxNumber[Size])\r
+                     ) {\r
+            ShellMmAccess (AccessType, PciRootBridgeIo, CpuIo, FALSE, Address, Size, &Buffer);\r
+          } else {\r
+            ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MM_ERROR), gShellDebug1HiiHandle, L"mm");\r
+            continue;\r
+          }\r
         }\r
       }\r
 \r