From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.100, mailfrom: star.zeng@intel.com) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by groups.io with SMTP; Tue, 16 Jul 2019 20:23:17 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Jul 2019 20:23:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,272,1559545200"; d="scan'208";a="169445936" Received: from shwdeopenpsi068.ccr.corp.intel.com ([10.239.158.38]) by fmsmga007.fm.intel.com with ESMTP; 16 Jul 2019 20:23:15 -0700 From: "Zeng, Star" To: devel@edk2.groups.io Cc: Star Zeng , Laszlo Ersek , Eric Dong , Ray Ni , Dandan Bi Subject: [PATCH] UefiCpuPkg DxeRegisterCpuFeaturesLib: Fix VS2012 build failure Date: Wed, 17 Jul 2019 11:23:14 +0800 Message-Id: <20190717032314.25408-1-star.zeng@intel.com> X-Mailer: git-send-email 2.21.0.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- .../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