From 04dd0cb972cd35f4bf59f5692096a65b840156d5 Mon Sep 17 00:00:00 2001 From: Star Zeng Date: Wed, 17 Jul 2019 11:19:48 +0800 Subject: [PATCH] UefiCpuPkg DxeRegisterCpuFeaturesLib: Fix VS2012 build failure BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1968 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 Cc: Eric Dong Cc: Ray Ni Cc: Dandan Bi Signed-off-by: Star Zeng Reviewed-by: Eric Dong Reviewed-by: Ray Ni --- .../RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLib.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLib.c b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLib.c index ffd99046a6..f87b2892aa 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,