From: "gaoliming" <gaoliming@byosoft.com.cn>
To: devel@edk2.groups.io
Cc: Jian J Wang <jian.j.wang@intel.com>, Hao A Wu <hao.a.wu@intel.com>
Subject: [Patch v2] MdeModulePkg: Initialize local variable value before they are used
Date: Thu, 18 Mar 2021 12:50:46 +0800 [thread overview]
Message-ID: <20210318045046.1909-1-gaoliming@byosoft.com.cn> (raw)
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 <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Signed-off-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
---
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
next reply other threads:[~2021-03-18 4:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-18 4:50 gaoliming [this message]
2021-03-18 14:38 ` [edk2-devel] [Patch v2] MdeModulePkg: Initialize local variable value before they are used Laszlo Ersek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210318045046.1909-1-gaoliming@byosoft.com.cn \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox