MdeModulePkg/PciBus: Change switch-case to if-else to fix EBC build
authorRuiyu Ni <ruiyu.ni@intel.com>
Tue, 9 Jan 2018 05:52:47 +0000 (13:52 +0800)
committerRuiyu Ni <ruiyu.ni@intel.com>
Wed, 10 Jan 2018 02:28:30 +0000 (10:28 +0800)
EBC compiler doesn't treat EFI_xxx as constant due to these macros
are UINT64 type in 64bit env and UINT32 type in 32bit env.
So it reports error when "case EFI_xxx" is used.
The patch changes to use if-else to fix EBC build failure.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c

index dc10866..9764963 100644 (file)
@@ -1154,19 +1154,13 @@ PciScanBus (
 \r
               FreePool (Descriptors);\r
 \r
-              switch (Status) {\r
-                case EFI_SUCCESS:\r
-                  BusPadding = TRUE;\r
-                  break;\r
-\r
-                case EFI_NOT_FOUND:\r
-                  //\r
-                  // no bus number padding requested\r
-                  //\r
-                  break;\r
-\r
-                default:\r
-                  return Status;\r
+              if (!EFI_ERROR (Status)) {\r
+                BusPadding = TRUE;\r
+              } else if (Status != EFI_NOT_FOUND) {\r
+                //\r
+                // EFI_NOT_FOUND is not a real error. It indicates no bus number padding requested.\r
+                //\r
+                return Status;\r
               }\r
             }\r
           }\r