* [patch] PcAtChipsetPkg/IsaAcpiDxe: Fix VS2012 build failure
@ 2017-11-22 2:02 Dandan Bi
2017-11-22 2:40 ` Ni, Ruiyu
0 siblings, 1 reply; 2+ messages in thread
From: Dandan Bi @ 2017-11-22 2:02 UTC (permalink / raw)
To: edk2-devel; +Cc: Ruiyu Ni
Done:
if (EFI_ERROR (Status)) {
if (PciIo != NULL && Enabled) {
PciIo->Attributes (
PciIo,
EfiPciIoAttributeOperationSet,
OriginalAttributes,
NULL
);
}
}
In above codes, VS2012/VS2010 will report that "OriginalAttributes"
will be used without initialization. But in fact, when the if expression
is true(if (PciIo != NULL && Enabled)), the "OriginalAttributes" must be
initialized. In order to fix this false positive issue, we initialize the
"OriginalAttributes" after declaration.
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
PcAtChipsetPkg/IsaAcpiDxe/PcatIsaAcpi.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/PcAtChipsetPkg/IsaAcpiDxe/PcatIsaAcpi.c b/PcAtChipsetPkg/IsaAcpiDxe/PcatIsaAcpi.c
index d82e2c4..c7ea559 100644
--- a/PcAtChipsetPkg/IsaAcpiDxe/PcatIsaAcpi.c
+++ b/PcAtChipsetPkg/IsaAcpiDxe/PcatIsaAcpi.c
@@ -176,10 +176,11 @@ PcatIsaAcpiDriverBindingStart (
BOOLEAN Enabled;
Enabled = FALSE;
Supports = 0;
PcatIsaAcpiDev = NULL;
+ OriginalAttributes = 0;
//
// Open the PCI I/O Protocol Interface
//
PciIo = NULL;
Status = gBS->OpenProtocol (
--
1.9.5.msysgit.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [patch] PcAtChipsetPkg/IsaAcpiDxe: Fix VS2012 build failure
2017-11-22 2:02 [patch] PcAtChipsetPkg/IsaAcpiDxe: Fix VS2012 build failure Dandan Bi
@ 2017-11-22 2:40 ` Ni, Ruiyu
0 siblings, 0 replies; 2+ messages in thread
From: Ni, Ruiyu @ 2017-11-22 2:40 UTC (permalink / raw)
To: Bi, Dandan, edk2-devel@lists.01.org
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
> -----Original Message-----
> From: Bi, Dandan
> Sent: Wednesday, November 22, 2017 10:02 AM
> To: edk2-devel@lists.01.org
> Cc: Ni, Ruiyu <ruiyu.ni@intel.com>
> Subject: [patch] PcAtChipsetPkg/IsaAcpiDxe: Fix VS2012 build failure
>
> Done:
> if (EFI_ERROR (Status)) {
> if (PciIo != NULL && Enabled) {
> PciIo->Attributes (
> PciIo,
> EfiPciIoAttributeOperationSet,
> OriginalAttributes,
> NULL
> );
> }
> }
> In above codes, VS2012/VS2010 will report that "OriginalAttributes"
> will be used without initialization. But in fact, when the if expression is true(if
> (PciIo != NULL && Enabled)), the "OriginalAttributes" must be initialized. In order
> to fix this false positive issue, we initialize the "OriginalAttributes" after
> declaration.
>
> Cc: Ruiyu Ni <ruiyu.ni@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Dandan Bi <dandan.bi@intel.com>
> ---
> PcAtChipsetPkg/IsaAcpiDxe/PcatIsaAcpi.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/PcAtChipsetPkg/IsaAcpiDxe/PcatIsaAcpi.c
> b/PcAtChipsetPkg/IsaAcpiDxe/PcatIsaAcpi.c
> index d82e2c4..c7ea559 100644
> --- a/PcAtChipsetPkg/IsaAcpiDxe/PcatIsaAcpi.c
> +++ b/PcAtChipsetPkg/IsaAcpiDxe/PcatIsaAcpi.c
> @@ -176,10 +176,11 @@ PcatIsaAcpiDriverBindingStart (
> BOOLEAN Enabled;
>
> Enabled = FALSE;
> Supports = 0;
> PcatIsaAcpiDev = NULL;
> + OriginalAttributes = 0;
> //
> // Open the PCI I/O Protocol Interface
> //
> PciIo = NULL;
> Status = gBS->OpenProtocol (
> --
> 1.9.5.msysgit.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-11-22 2:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-22 2:02 [patch] PcAtChipsetPkg/IsaAcpiDxe: Fix VS2012 build failure Dandan Bi
2017-11-22 2:40 ` Ni, Ruiyu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox