[edk2] [patch] PcAtChipsetPkg/IsaAcpiDxe: Fix VS2012 build failure

Dandan Bi posted 1 patch 7 years, 1 month ago
Failed in applying to current master (apply log)
PcAtChipsetPkg/IsaAcpiDxe/PcatIsaAcpi.c | 1 +
1 file changed, 1 insertion(+)
[edk2] [patch] PcAtChipsetPkg/IsaAcpiDxe: Fix VS2012 build failure
Posted by Dandan Bi 7 years, 1 month ago
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

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [patch] PcAtChipsetPkg/IsaAcpiDxe: Fix VS2012 build failure
Posted by Ni, Ruiyu 7 years, 1 month ago
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

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