* [PATCH] UefiCpuPkg DxeRegisterCpuFeaturesLib: Fix VS2012 build failure
@ 2019-07-17 3:23 Zeng, Star
2019-07-17 3:26 ` Dong, Eric
0 siblings, 1 reply; 2+ messages in thread
From: Zeng, Star @ 2019-07-17 3:23 UTC (permalink / raw)
To: devel; +Cc: Star Zeng, Laszlo Ersek, Eric Dong, Ray Ni, Dandan Bi
The new VS2012 build failure is caused by 7a0df26.
xxx\registercpufeatureslib\dxeregistercpufeatureslib.c(258) :
warning C4701: potentially uninitialized local variable 'MpEvent' used
It is a false positive alarm.
MpEvent is assigned at line 238 and will be used at line 258, both
lines are controlled by "if (CpuFeaturesData->NumberOfCpus > 1)".
This patch initializes MpEvent to suppress incorrect compiler/analyzer
warnings.
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Signed-off-by: Star Zeng <star.zeng@intel.com>
---
.../RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLib.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLib.c b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLib.c
index ffd99046a6cd..f87b2892aaae 100644
--- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLib.c
+++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLib.c
@@ -229,6 +229,12 @@ CpuFeaturesInitialize (
OldBspNumber = GetProcessorIndex (CpuFeaturesData);
CpuFeaturesData->BspNumber = OldBspNumber;
+ //
+ //
+ // Initialize MpEvent to suppress incorrect compiler/analyzer warnings.
+ //
+ MpEvent = NULL;
+
if (CpuFeaturesData->NumberOfCpus > 1) {
Status = gBS->CreateEvent (
EVT_NOTIFY_WAIT,
--
2.21.0.windows.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] UefiCpuPkg DxeRegisterCpuFeaturesLib: Fix VS2012 build failure
2019-07-17 3:23 [PATCH] UefiCpuPkg DxeRegisterCpuFeaturesLib: Fix VS2012 build failure Zeng, Star
@ 2019-07-17 3:26 ` Dong, Eric
0 siblings, 0 replies; 2+ messages in thread
From: Dong, Eric @ 2019-07-17 3:26 UTC (permalink / raw)
To: Zeng, Star, devel@edk2.groups.io; +Cc: Laszlo Ersek, Ni, Ray, Bi, Dandan
Reviewed-by: Eric Dong <eric.dong@intel.com>
> -----Original Message-----
> From: Zeng, Star
> Sent: Wednesday, July 17, 2019 11:23 AM
> To: devel@edk2.groups.io
> Cc: Zeng, Star <star.zeng@intel.com>; Laszlo Ersek <lersek@redhat.com>;
> Dong, Eric <eric.dong@intel.com>; Ni, Ray <ray.ni@intel.com>; Bi, Dandan
> <dandan.bi@intel.com>
> Subject: [PATCH] UefiCpuPkg DxeRegisterCpuFeaturesLib: Fix VS2012 build
> failure
>
> The new VS2012 build failure is caused by 7a0df26.
>
> xxx\registercpufeatureslib\dxeregistercpufeatureslib.c(258) :
> warning C4701: potentially uninitialized local variable 'MpEvent' used
>
> It is a false positive alarm.
> MpEvent is assigned at line 238 and will be used at line 258, both lines are
> controlled by "if (CpuFeaturesData->NumberOfCpus > 1)".
>
> This patch initializes MpEvent to suppress incorrect compiler/analyzer
> warnings.
>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Dandan Bi <dandan.bi@intel.com>
> Signed-off-by: Star Zeng <star.zeng@intel.com>
> ---
> .../RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLib.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git
> a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLib.c
> b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLib.c
> index ffd99046a6cd..f87b2892aaae 100644
> ---
> a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLib.c
> +++
> b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLi
> +++ b.c
> @@ -229,6 +229,12 @@ CpuFeaturesInitialize (
> OldBspNumber = GetProcessorIndex (CpuFeaturesData);
> CpuFeaturesData->BspNumber = OldBspNumber;
>
> + //
> + //
> + // Initialize MpEvent to suppress incorrect compiler/analyzer warnings.
> + //
> + MpEvent = NULL;
> +
> if (CpuFeaturesData->NumberOfCpus > 1) {
> Status = gBS->CreateEvent (
> EVT_NOTIFY_WAIT,
> --
> 2.21.0.windows.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-07-17 3:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-17 3:23 [PATCH] UefiCpuPkg DxeRegisterCpuFeaturesLib: Fix VS2012 build failure Zeng, Star
2019-07-17 3:26 ` Dong, Eric
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox