* [PATCH] MdeModulePkg/PciBus: Change switch-case to if-else to fix EBC build
@ 2018-01-09 5:53 Ruiyu Ni
2018-01-09 10:50 ` Laszlo Ersek
0 siblings, 1 reply; 2+ messages in thread
From: Ruiyu Ni @ 2018-01-09 5:53 UTC (permalink / raw)
To: edk2-devel; +Cc: Laszlo Ersek
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>
Cc: Laszlo Ersek <lersek@redhat.com>
---
MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c | 20 +++++++-------------
1 file changed, 7 insertions(+), 13 deletions(-)
diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c
index dc1086606f..976496379a 100644
--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c
+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c
@@ -1154,19 +1154,13 @@ PciScanBus (
FreePool (Descriptors);
- switch (Status) {
- case EFI_SUCCESS:
- BusPadding = TRUE;
- break;
-
- case EFI_NOT_FOUND:
- //
- // no bus number padding requested
- //
- break;
-
- default:
- return Status;
+ if (!EFI_ERROR (Status)) {
+ BusPadding = TRUE;
+ } else if (Status != EFI_NOT_FOUND) {
+ //
+ // EFI_NOT_FOUND is not a real error. It indicates no bus number padding requested.
+ //
+ return Status;
}
}
}
--
2.15.1.windows.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] MdeModulePkg/PciBus: Change switch-case to if-else to fix EBC build
2018-01-09 5:53 [PATCH] MdeModulePkg/PciBus: Change switch-case to if-else to fix EBC build Ruiyu Ni
@ 2018-01-09 10:50 ` Laszlo Ersek
0 siblings, 0 replies; 2+ messages in thread
From: Laszlo Ersek @ 2018-01-09 10:50 UTC (permalink / raw)
To: Ruiyu Ni, edk2-devel
On 01/09/18 06:53, Ruiyu Ni wrote:
> 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>
> Cc: Laszlo Ersek <lersek@redhat.com>
> ---
> MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c | 20 +++++++-------------
> 1 file changed, 7 insertions(+), 13 deletions(-)
>
> diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c
> index dc1086606f..976496379a 100644
> --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c
> +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c
> @@ -1154,19 +1154,13 @@ PciScanBus (
>
> FreePool (Descriptors);
>
> - switch (Status) {
> - case EFI_SUCCESS:
> - BusPadding = TRUE;
> - break;
> -
> - case EFI_NOT_FOUND:
> - //
> - // no bus number padding requested
> - //
> - break;
> -
> - default:
> - return Status;
> + if (!EFI_ERROR (Status)) {
> + BusPadding = TRUE;
> + } else if (Status != EFI_NOT_FOUND) {
> + //
> + // EFI_NOT_FOUND is not a real error. It indicates no bus number padding requested.
> + //
> + return Status;
> }
> }
> }
>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-01-09 10:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-09 5:53 [PATCH] MdeModulePkg/PciBus: Change switch-case to if-else to fix EBC build Ruiyu Ni
2018-01-09 10:50 ` Laszlo Ersek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox