[ammarfaizi2-block:kvalo/ath/pending 283/294] drivers/net/wireless/ath/ath11k/pci_cmn.c:185:10: warning: variable 'val' is used uninitialized whenever 'if' condition is false
From: kernel test robot
Date: Mon Jan 17 2022 - 15:58:08 EST
tree: https://github.com/ammarfaizi2/linux-block kvalo/ath/pending
head: 8415824bf3ea5c313f15b902497cd2834c01e78e
commit: f38b44f68cd13a37d90c62863250c16b951e202e [283/294] ath11k: Add register access logic for WCN6750
config: arm64-randconfig-r011-20220116 (https://download.01.org/0day-ci/archive/20220118/202201180419.pxOIAhwJ-lkp@xxxxxxxxx/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 5f782d25a742302d25ef3c8b84b54f7483c2deb9)
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://github.com/ammarfaizi2/linux-block/commit/f38b44f68cd13a37d90c62863250c16b951e202e
git remote add ammarfaizi2-block https://github.com/ammarfaizi2/linux-block
git fetch --no-tags ammarfaizi2-block kvalo/ath/pending
git checkout f38b44f68cd13a37d90c62863250c16b951e202e
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm64 SHELL=/bin/bash drivers/net/wireless/ath/ath11k/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
All warnings (new ones prefixed by >>):
>> drivers/net/wireless/ath/ath11k/pci_cmn.c:185:10: warning: variable 'val' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
} else if (ab->bus_params.ops.window_read32) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler.h:56:28: note: expanded from macro 'if'
#define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler.h:58:30: note: expanded from macro '__trace_if_var'
#define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/wireless/ath/ath11k/pci_cmn.c:195:9: note: uninitialized use occurs here
return val;
^~~
drivers/net/wireless/ath/ath11k/pci_cmn.c:185:10: note: remove the 'if' if its condition is always true
} else if (ab->bus_params.ops.window_read32) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler.h:56:23: note: expanded from macro 'if'
#define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
^
drivers/net/wireless/ath/ath11k/pci_cmn.c:168:9: note: initialize the variable 'val' to silence this warning
u32 val, window_start;
^
= 0
1 warning generated.
vim +185 drivers/net/wireless/ath/ath11k/pci_cmn.c
165
166 u32 ath11k_pci_read32(struct ath11k_base *ab, u32 offset)
167 {
168 u32 val, window_start;
169
170 /* for offset beyond BAR + 4K - 32, may
171 * need to wakeup the device to access.
172 */
173 if (test_bit(ATH11K_FLAG_DEVICE_INIT_DONE, &ab->dev_flags) &&
174 offset >= ATH11K_PCI_ACCESS_ALWAYS_OFF &&
175 ab->bus_params.ops.wakeup)
176 ab->bus_params.ops.wakeup(ab);
177
178 if (offset < ATH11K_PCI_WINDOW_START) {
179 val = ioread32(ab->mem + offset);
180 } else {
181 if (ab->bus_params.static_window_map) {
182 window_start = ath11k_pci_get_window_start(ab, offset);
183 val = ioread32(ab->mem + window_start +
184 (offset & ATH11K_PCI_WINDOW_RANGE_MASK));
> 185 } else if (ab->bus_params.ops.window_read32) {
186 val = ab->bus_params.ops.window_read32(ab, offset);
187 }
188 }
189
190 if (test_bit(ATH11K_FLAG_DEVICE_INIT_DONE, &ab->dev_flags) &&
191 offset >= ATH11K_PCI_ACCESS_ALWAYS_OFF &&
192 ab->bus_params.ops.release)
193 ab->bus_params.ops.release(ab);
194
195 return val;
196 }
197
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx