]> git.proxmox.com Git - mirror_edk2.git/commitdiff
UefiCpuPkg DxeRegisterCpuFeaturesLib: Fix VS2012 build failure
authorStar Zeng <star.zeng@intel.com>
Wed, 17 Jul 2019 03:19:48 +0000 (11:19 +0800)
committerEric Dong <eric.dong@intel.com>
Thu, 18 Jul 2019 00:22:19 +0000 (08:22 +0800)
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 <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>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLib.c

index ffd99046a6cd5458f9749ab63bf00a95a3638fb1..f87b2892aaae439ac2f62d03b3fa7408249af848 100644 (file)
@@ -229,6 +229,12 @@ CpuFeaturesInitialize (
   OldBspNumber = GetProcessorIndex (CpuFeaturesData);\r
   CpuFeaturesData->BspNumber = OldBspNumber;\r
 \r
+  //\r
+  //\r
+  // Initialize MpEvent to suppress incorrect compiler/analyzer warnings.\r
+  //\r
+  MpEvent = NULL;\r
+\r
   if (CpuFeaturesData->NumberOfCpus > 1) {\r
     Status = gBS->CreateEvent (\r
                     EVT_NOTIFY_WAIT,\r