oe-kbuild-all.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [atishp04:kvm_perf_snapshot_rfc 3/7] drivers/perf/riscv_pmu_sbi.c:470:17: warning: this 'if' clause does not guard...
@ 2023-05-09  0:04 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2023-05-09  0:04 UTC (permalink / raw)
  To: Atish Patra; +Cc: oe-kbuild-all, Atish Patra

tree:   https://github.com/atishp04/linux kvm_perf_snapshot_rfc
head:   5ae7188de04f861c3f4026005a0ace2cf2575bde
commit: 49f64ef2ce6b12fd54fc64df1ec2a0d28663b6cb [3/7] drivers/pmu: sbi: Read upper bits of a firmware counter
config: riscv-rv32_defconfig (https://download.01.org/0day-ci/archive/20230509/202305090836.Y1opUCBj-lkp@intel.com/config)
compiler: riscv32-linux-gcc (GCC) 12.1.0
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://github.com/atishp04/linux/commit/49f64ef2ce6b12fd54fc64df1ec2a0d28663b6cb
        git remote add atishp04 https://github.com/atishp04/linux
        git fetch --no-tags atishp04 kvm_perf_snapshot_rfc
        git checkout 49f64ef2ce6b12fd54fc64df1ec2a0d28663b6cb
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=riscv olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=riscv SHELL=/bin/bash arch/riscv/kvm/ drivers/perf/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202305090836.Y1opUCBj-lkp@intel.com/

All warnings (new ones prefixed by >>):

   drivers/perf/riscv_pmu_sbi.c: In function 'pmu_sbi_ctr_read':
>> drivers/perf/riscv_pmu_sbi.c:470:17: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
     470 |                 if (sbi_v2_available && info.width >= 32)
         |                 ^~
   drivers/perf/riscv_pmu_sbi.c:473:25: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
     473 |                         if (!ret.error)
         |                         ^~
>> drivers/perf/riscv_pmu_sbi.c:474:56: warning: left shift count >= width of type [-Wshift-count-overflow]
     474 |                                 val = val | (ret.value << 32);
         |                                                        ^~


vim +/if +470 drivers/perf/riscv_pmu_sbi.c

   455	
   456	static u64 pmu_sbi_ctr_read(struct perf_event *event)
   457	{
   458		struct hw_perf_event *hwc = &event->hw;
   459		int idx = hwc->idx;
   460		struct sbiret ret;
   461		u64 val = 0;
   462		union sbi_pmu_ctr_info info = pmu_ctr_list[idx];
   463	
   464		if (pmu_sbi_is_fw_event(event)) {
   465			ret = sbi_ecall(SBI_EXT_PMU, SBI_EXT_PMU_COUNTER_FW_READ,
   466					hwc->idx, 0, 0, 0, 0, 0);
   467			if (!ret.error)
   468				val = ret.value;
   469	#if defined(CONFIG_32BIT)
 > 470			if (sbi_v2_available && info.width >= 32)
   471				ret = sbi_ecall(SBI_EXT_PMU, SBI_EXT_PMU_COUNTER_FW_READ_HI,
   472						hwc->idx, 0, 0, 0, 0, 0);
   473				if (!ret.error)
 > 474					val = val | (ret.value << 32);
   475	#endif
   476		} else {
   477			val = riscv_pmu_ctr_read_csr(info.csr);
   478			if (IS_ENABLED(CONFIG_32BIT))
   479				val = ((u64)riscv_pmu_ctr_read_csr(info.csr + 0x80)) << 31 | val;
   480		}
   481	
   482		return val;
   483	}
   484	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-05-09  0:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-09  0:04 [atishp04:kvm_perf_snapshot_rfc 3/7] drivers/perf/riscv_pmu_sbi.c:470:17: warning: this 'if' clause does not guard kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).