Re: drivers/perf/hisilicon/hisi_uncore_hha_pmu.c:89:7: warning: variable 'val' set but not used

From: Shaokun Zhang
Date: Wed Jun 02 2021 - 23:29:45 EST


Hi,

On 2021/6/3 8:28, kernel test robot wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: 324c92e5e0ee0e993bdb106fac407846ed677f6b
> commit: 932f6a99f9b0c6b7039a5e2ce961009a8dc8c07c drivers/perf: hisi: Add new functions for HHA PMU
> date: 10 weeks ago
> config: arm64-randconfig-r005-20210603 (attached as .config)
> compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project d8e0ae9a76a62bdc6117630d59bf9967ac9bb4ea)
> 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
> # install arm64 cross compiling tool for clang build
> # apt-get install binutils-aarch64-linux-gnu
> # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=932f6a99f9b0c6b7039a5e2ce961009a8dc8c07c
> git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> git fetch --no-tags linus master
> git checkout 932f6a99f9b0c6b7039a5e2ce961009a8dc8c07c
> # save the attached .config to linux build tree
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@xxxxxxxxx>
>
> All warnings (new ones prefixed by >>):
>
> In file included from drivers/perf/hisilicon/hisi_uncore_hha_pmu.c:11:
> In file included from include/linux/acpi.h:35:
> In file included from include/acpi/acpi_io.h:7:
> In file included from arch/arm64/include/asm/acpi.h:12:
> include/linux/efi.h:1093:34: warning: passing 1-byte aligned argument to 4-byte aligned parameter 2 of 'get_var' may result in an unaligned pointer access [-Walign-mismatch]
> status = get_var(L"SecureBoot", &EFI_GLOBAL_VARIABLE_GUID, NULL, &size,
> ^
> include/linux/efi.h:1101:24: warning: passing 1-byte aligned argument to 4-byte aligned parameter 2 of 'get_var' may result in an unaligned pointer access [-Walign-mismatch]
> get_var(L"SetupMode", &EFI_GLOBAL_VARIABLE_GUID, NULL, &size, &setupmode);
> ^
>>> drivers/perf/hisilicon/hisi_uncore_hha_pmu.c:89:7: warning: variable 'val' set but not used [-Wunused-but-set-variable]
> u32 val;
>

Oops, my bad, there is a bug that shall be fixed. I will post it later.

Thanks for the report,
Shaokun


^
> drivers/perf/hisilicon/hisi_uncore_hha_pmu.c:103:7: warning: variable 'val' set but not used [-Wunused-but-set-variable]
> u32 val;
> ^
> 4 warnings generated.
>
>
> vim +/val +89 drivers/perf/hisilicon/hisi_uncore_hha_pmu.c
>
> 82
> 83 static void hisi_hha_pmu_config_ds(struct perf_event *event)
> 84 {
> 85 struct hisi_pmu *hha_pmu = to_hisi_pmu(event->pmu);
> 86 u32 ds_skt = hisi_get_datasrc_skt(event);
> 87
> 88 if (ds_skt) {
> > 89 u32 val;
> 90
> 91 val = readl(hha_pmu->base + HHA_DATSRC_CTRL);
> 92 val |= HHA_DATSRC_SKT_EN;
> 93 writel(ds_skt, hha_pmu->base + HHA_DATSRC_CTRL);
> 94 }
> 95 }
> 96
>
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
>