[esmil:visionfive 22/54] drivers/soc/sifive/sifive_l2_cache.c:142:19: warning: result of comparison of constant 36507222016 with expression of type 'unsigned long' is always false

kernel test robot
2022-06-10T08:33:14Z

tree: https://github.com/esmil/linux visionfive
head: 906be7ef2fb9e2f1fcb740d3d506768cddfc52ca
commit: 1c9c971346b0ca811114ae00fce28cbf3c34232b [22/54] sifive/sifive_l2_cache: Add sifive_l2_flush64_range function
config: riscv-buildonly-randconfig-r006-20220609 (https://download.01.org/0day-ci/archive/20220610/202206101615.iqFYh0RG-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 70d35fe1257e429266b83025997b400e9f79110e)
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 riscv cross compiling tool for clang build
# apt-get install binutils-riscv-linux-gnu
# https://github.com/esmil/linux/commit/1c9c971346b0ca811114ae00fce28cbf3c34232b
git remote add esmil https://github.com/esmil/linux
git fetch --no-tags esmil visionfive
git checkout 1c9c971346b0ca811114ae00fce28cbf3c34232b
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=riscv SHELL=/bin/bash drivers/soc/sifive/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

drivers/soc/sifive/sifive_l2_cache.c:152:3: error: call to undeclared function 'writeq'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
writeq(line, l2_base + SIFIVE_L2_FLUSH64);
^
>> drivers/soc/sifive/sifive_l2_cache.c:142:19: warning: result of comparison of constant 36507222016 with expression of type 'unsigned long' is always false [-Wtautological-constant-out-of-range-compare]
(start + len) > (CONFIG_SIFIVE_L2_FLUSH_START +
~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning and 1 error generated.

vim +142 drivers/soc/sifive/sifive_l2_cache.c

123
124 #ifdef CONFIG_SIFIVE_L2_FLUSH
125 void sifive_l2_flush64_range(unsigned long start, unsigned long len)
126 {
127 unsigned long line;
128
129 if(!l2_base) {
130 pr_warn("L2CACHE: base addr invalid, skipping flush\n");
131 return;
132 }
133
134 /* TODO: if (len == 0), skipping flush or going on? */
135 if(!len) {
136 pr_debug("L2CACHE: flush64 range @ 0x%lx(len:0)\n", start);
137 return;
138 }
139
140 /* make sure the address is in the range */
141 if(start < CONFIG_SIFIVE_L2_FLUSH_START ||
> 142 (start + len) > (CONFIG_SIFIVE_L2_FLUSH_START +
143 CONFIG_SIFIVE_L2_FLUSH_SIZE)) {
144 pr_warn("L2CACHE: flush64 out of range: %lx(%lx), skip flush\n",
145 start, len);
146 return;
147 }
148
149 mb(); /* sync */
150 for (line = start; line < start + len;
151 line += SIFIVE_L2_FLUSH64_LINE_LEN) {
> 152 writeq(line, l2_base + SIFIVE_L2_FLUSH64);
153 mb();
154 }
155 }
156 EXPORT_SYMBOL_GPL(sifive_l2_flush64_range);
157 #endif
158

--
0-DAY CI Kernel Test Service