[edk2-devel] [Patch v2] MdeModulePkg: Initialize local variable value before they are used
gaoliming
gaoliming at byosoft.com.cn
Thu Mar 18 04:50:46 UTC 2021
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 at intel.com>
Cc: Hao A Wu <hao.a.wu at intel.com>
Signed-off-by: Liming Gao <gaoliming at byosoft.com.cn>
Reviewed-by: Hao A Wu <hao.a.wu at 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
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#73002): https://edk2.groups.io/g/devel/message/73002
Mute This Topic: https://groups.io/mt/81422804/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-
More information about the edk2-devel-archive
mailing list