From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.byosoft.com.cn (mail.byosoft.com.cn [58.240.74.242]) by mx.groups.io with SMTP id smtpd.web11.4987.1616043066481712253 for ; Wed, 17 Mar 2021 21:51:08 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=none, err=permanent DNS error (domain: byosoft.com.cn, ip: 58.240.74.242, mailfrom: gaoliming@byosoft.com.cn) Received: from localhost.localdomain ([58.246.60.130]) (envelope-sender ) by 192.168.6.13 with ESMTP for ; Thu, 18 Mar 2021 12:51:01 +0800 X-WM-Sender: gaoliming@byosoft.com.cn X-Originating-IP: 58.246.60.130 X-WM-AuthFlag: YES X-WM-AuthUser: gaoliming@byosoft.com.cn From: "gaoliming" To: devel@edk2.groups.io Cc: Jian J Wang , Hao A Wu Subject: [Patch v2] MdeModulePkg: Initialize local variable value before they are used Date: Thu, 18 Mar 2021 12:50:46 +0800 Message-Id: <20210318045046.1909-1-gaoliming@byosoft.com.cn> X-Mailer: git-send-email 2.27.0.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3228 This change is to fix the false compiler error on GCC49 release build. Cc: Jian J Wang Cc: Hao A Wu Signed-off-by: Liming Gao Reviewed-by: Hao A Wu --- In V2, add the comments for the false compiler warning MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c | 5 +++++ .../VariablePolicyHelperLib/VariablePolicyHelperLib.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c index e99a812a44..1053695b3b 100644 --- a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c +++ b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c @@ -1127,6 +1127,11 @@ AhciDmaTransfer ( return EFI_INVALID_PARAMETER; } + // + // Set Status to suppress incorrect compiler/analyzer warnings + // + Status = EFI_SUCCESS; + // // DMA buffer allocation. Needs to be done only once for both sync and async // DMA transfers irrespective of number of retries. diff --git a/MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.c b/MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.c index 0c9299c8b0..6bcb95247f 100644 --- a/MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.c +++ b/MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.c @@ -115,6 +115,11 @@ CreateBasicVariablePolicy ( return EFI_INVALID_PARAMETER; } + // + // Set NameSize to suppress incorrect compiler/analyzer warnings + // + NameSize = 0; + // Now we've gotta determine the total size of the buffer required for // the VariablePolicy structure. TotalSize = sizeof( VARIABLE_POLICY_ENTRY ); -- 2.27.0.windows.1