[morse:mpam/snapshot/v5.18 98/146] drivers/platform/mpam/mpam_devices.c:240:17: warning: result of comparison of constant 18446744073709551615 with expression of type 'u32' (aka 'unsigned int') is always false
From: kernel test robot
Date: Sun Jun 19 2022 - 16:25:24 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/morse/linux.git mpam/snapshot/v5.18
head: bac90d25cbdee0fc233b9b1c47d5b6f44101a384
commit: 6e089af1ca40d30c3002cda7363110e63baf4803 [98/146] arm_mpam: Add the class and component structures for ris firmware described
config: arm64-allmodconfig (https://download.01.org/0day-ci/archive/20220620/202206200439.A8h6zahb-lkp@xxxxxxxxx/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project af6d2a0b6825e71965f3e2701a63c239fa0ad70f)
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/morse/linux.git/commit/?id=6e089af1ca40d30c3002cda7363110e63baf4803
git remote add morse https://git.kernel.org/pub/scm/linux/kernel/git/morse/linux.git
git fetch --no-tags morse mpam/snapshot/v5.18
git checkout 6e089af1ca40d30c3002cda7363110e63baf4803
# 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=arm64 SHELL=/bin/bash drivers/perf/ drivers/platform/mpam/
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@xxxxxxxxx>
All warnings (new ones prefixed by >>):
>> drivers/platform/mpam/mpam_devices.c:240:17: warning: result of comparison of constant 18446744073709551615 with expression of type 'u32' (aka 'unsigned int') is always false [-Wtautological-constant-out-of-range-compare]
if (cache_id == ~0UL) {
~~~~~~~~ ^ ~~~~
drivers/platform/mpam/mpam_devices.c:404:14: warning: variable 'cache' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
} else if (of_device_is_compatible(np->parent, "cache")) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/platform/mpam/mpam_devices.c:426:14: note: uninitialized use occurs here
of_node_put(cache);
^~~~~
drivers/platform/mpam/mpam_devices.c:404:10: note: remove the 'if' if its condition is always true
} else if (of_device_is_compatible(np->parent, "cache")) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/platform/mpam/mpam_devices.c:395:27: note: initialize the variable 'cache' to silence this warning
struct device_node *cache;
^
= NULL
2 warnings generated.
vim +240 drivers/platform/mpam/mpam_devices.c
204
205 /*
206 * The cacheinfo structures are only populated when CPUs are online.
207 * This helper walks the device tree to include offline CPUs too.
208 */
209 static int get_cpumask_from_cache_id(u32 cache_id, u32 cache_level,
210 cpumask_t *affinity)
211 {
212 int cpu, err;
213 u32 iter_level;
214 int iter_cache_id;
215 struct device_node *iter;
216
217 if (!acpi_disabled)
218 return acpi_pptt_get_cpumask_from_cache_id(cache_id, affinity);
219
220 for_each_possible_cpu(cpu) {
221 iter = of_get_cpu_node(cpu, NULL);
222 if (!iter) {
223 pr_err("Failed to find cpu%d device node\n", cpu);
224 return -ENOENT;
225 }
226
227 while ((iter = of_find_next_cache_node(iter))) {
228 err = of_property_read_u32(iter, "cache-level",
229 &iter_level);
230 if (err || (iter_level != cache_level)) {
231 of_node_put(iter);
232 continue;
233 }
234
235 /*
236 * get_cpu_cacheinfo_id() isn't ready until sometime
237 * during device_initcall(). Use cache_of_get_id().
238 */
239 iter_cache_id = cache_of_get_id(iter);
> 240 if (cache_id == ~0UL) {
241 of_node_put(iter);
242 continue;
243 }
244
245 if (iter_cache_id == cache_id)
246 cpumask_set_cpu(cpu, affinity);
247
248 of_node_put(iter);
249 }
250 }
251
252 return 0;
253 }
254
--
0-DAY CI Kernel Test Service
https://01.org/lkp