lkml.org 
[lkml]   [2022]   [Apr]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
Subject[tip:perf/core 3/10] arch/x86/events/amd/core.c:722:3: warning: Value stored to 'hwc' is never read [clang-analyzer-deadcode.DeadStores]
From
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf/core
head: 7bebfe9dd802b80abff5a43e00ab68d98893a22c
commit: ada543459cab7f653dcacdaba4011a8bb19c627c [3/10] perf/x86/amd: Add AMD Fam19h Branch Sampling support
config: x86_64-randconfig-c007 (https://download.01.org/0day-ci/archive/20220411/202204110431.SBvb4g5G-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project c29a51b3a257908aebc01cd7c4655665db317d66)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?id=ada543459cab7f653dcacdaba4011a8bb19c627c
git remote add tip https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
git fetch --no-tags tip perf/core
git checkout ada543459cab7f653dcacdaba4011a8bb19c627c
# save the config file to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 clang-analyzer

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <yujie.liu@intel.com>


clang-analyzer warnings: (new ones prefixed by >>)

>> arch/x86/events/amd/core.c:722:3: warning: Value stored to 'hwc' is never read [clang-analyzer-deadcode.DeadStores]
hwc = &cpuc->events[idx]->hw;
^ ~~~~~~~~~~~~~~~~~~~~~~

vim +/hwc +722 arch/x86/events/amd/core.c

ada543459cab7f Stephane Eranian 2022-03-22 712
ada543459cab7f Stephane Eranian 2022-03-22 713 static void amd_pmu_enable_all(int added)
ada543459cab7f Stephane Eranian 2022-03-22 714 {
ada543459cab7f Stephane Eranian 2022-03-22 715 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
ada543459cab7f Stephane Eranian 2022-03-22 716 struct hw_perf_event *hwc;
ada543459cab7f Stephane Eranian 2022-03-22 717 int idx;
ada543459cab7f Stephane Eranian 2022-03-22 718
ada543459cab7f Stephane Eranian 2022-03-22 719 amd_brs_enable_all();
ada543459cab7f Stephane Eranian 2022-03-22 720
ada543459cab7f Stephane Eranian 2022-03-22 721 for (idx = 0; idx < x86_pmu.num_counters; idx++) {
ada543459cab7f Stephane Eranian 2022-03-22 @722 hwc = &cpuc->events[idx]->hw;
ada543459cab7f Stephane Eranian 2022-03-22 723
ada543459cab7f Stephane Eranian 2022-03-22 724 /* only activate events which are marked as active */
ada543459cab7f Stephane Eranian 2022-03-22 725 if (!test_bit(idx, cpuc->active_mask))
ada543459cab7f Stephane Eranian 2022-03-22 726 continue;
ada543459cab7f Stephane Eranian 2022-03-22 727
ada543459cab7f Stephane Eranian 2022-03-22 728 amd_pmu_enable_event(cpuc->events[idx]);
ada543459cab7f Stephane Eranian 2022-03-22 729 }
ada543459cab7f Stephane Eranian 2022-03-22 730 }
ada543459cab7f Stephane Eranian 2022-03-22 731

--
0-DAY CI Kernel Test Service
https://01.org/lkp

\
 
 \ /
  Last update: 2022-04-13 10:45    [W:0.030 / U:0.136 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site