[mingo-tip:sched/headers 1505/2574] drivers/hwspinlock/hwspinlock_core.c:369:26: sparse: sparse: incompatible types in comparison expression (different address spaces):

From: kernel test robot
Date: Mon Feb 21 2022 - 06:19:51 EST


tree: git://git.kernel.org/pub/scm/linux/kernel/git/mingo/tip.git sched/headers
head: 39e8a0edc8fae20758051dadf7846849edc18b88
commit: 75d1193425bb839256332fc5d2d7051f603a1830 [1505/2574] headers/deps: radix-tree: Optimize <linux/radix-tree.h> dependencies, remove <linux/rcupdate.h>
config: x86_64-randconfig-s022-20220221 (https://download.01.org/0day-ci/archive/20220221/202202211957.Gxf9NwU6-lkp@xxxxxxxxx/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.4-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/mingo/tip.git/commit/?id=75d1193425bb839256332fc5d2d7051f603a1830
git remote add mingo-tip git://git.kernel.org/pub/scm/linux/kernel/git/mingo/tip.git
git fetch --no-tags mingo-tip sched/headers
git checkout 75d1193425bb839256332fc5d2d7051f603a1830
# save the config file to linux build tree
mkdir build_dir
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=x86_64 SHELL=/bin/bash arch/x86/entry/vsyscall/ drivers/hwspinlock/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>


sparse warnings: (new ones prefixed by >>)
drivers/hwspinlock/hwspinlock_core.c:368:9: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected void **slot @@ got void [noderef] __rcu ** @@
drivers/hwspinlock/hwspinlock_core.c:368:9: sparse: expected void **slot
drivers/hwspinlock/hwspinlock_core.c:368:9: sparse: got void [noderef] __rcu **
drivers/hwspinlock/hwspinlock_core.c:368:9: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected void **slot @@ got void [noderef] __rcu ** @@
drivers/hwspinlock/hwspinlock_core.c:368:9: sparse: expected void **slot
drivers/hwspinlock/hwspinlock_core.c:368:9: sparse: got void [noderef] __rcu **
>> drivers/hwspinlock/hwspinlock_core.c:369:26: sparse: sparse: incompatible types in comparison expression (different address spaces):
>> drivers/hwspinlock/hwspinlock_core.c:369:26: sparse: void [noderef] __rcu *
>> drivers/hwspinlock/hwspinlock_core.c:369:26: sparse: void *
drivers/hwspinlock/hwspinlock_core.c:98:5: sparse: sparse: context imbalance in '__hwspin_trylock' - different lock contexts for basic block
drivers/hwspinlock/hwspinlock_core.c:296:39: sparse: sparse: context imbalance in '__hwspin_unlock' - unexpected unlock

vim +369 drivers/hwspinlock/hwspinlock_core.c

fb7737e949e31d Suman Anna 2015-03-04 331
fb7737e949e31d Suman Anna 2015-03-04 332 /**
fb7737e949e31d Suman Anna 2015-03-04 333 * of_hwspin_lock_get_id() - get lock id for an OF phandle-based specific lock
fb7737e949e31d Suman Anna 2015-03-04 334 * @np: device node from which to request the specific hwlock
fb7737e949e31d Suman Anna 2015-03-04 335 * @index: index of the hwlock in the list of values
fb7737e949e31d Suman Anna 2015-03-04 336 *
fb7737e949e31d Suman Anna 2015-03-04 337 * This function provides a means for DT users of the hwspinlock module to
fb7737e949e31d Suman Anna 2015-03-04 338 * get the global lock id of a specific hwspinlock using the phandle of the
fb7737e949e31d Suman Anna 2015-03-04 339 * hwspinlock device, so that it can be requested using the normal
fb7737e949e31d Suman Anna 2015-03-04 340 * hwspin_lock_request_specific() API.
fb7737e949e31d Suman Anna 2015-03-04 341 *
fb7737e949e31d Suman Anna 2015-03-04 342 * Returns the global lock id number on success, -EPROBE_DEFER if the hwspinlock
fb7737e949e31d Suman Anna 2015-03-04 343 * device is not yet registered, -EINVAL on invalid args specifier value or an
fb7737e949e31d Suman Anna 2015-03-04 344 * appropriate error as returned from the OF parsing of the DT client node.
fb7737e949e31d Suman Anna 2015-03-04 345 */
fb7737e949e31d Suman Anna 2015-03-04 346 int of_hwspin_lock_get_id(struct device_node *np, int index)
fb7737e949e31d Suman Anna 2015-03-04 347 {
fb7737e949e31d Suman Anna 2015-03-04 348 struct of_phandle_args args;
fb7737e949e31d Suman Anna 2015-03-04 349 struct hwspinlock *hwlock;
fb7737e949e31d Suman Anna 2015-03-04 350 struct radix_tree_iter iter;
fb7737e949e31d Suman Anna 2015-03-04 351 void **slot;
fb7737e949e31d Suman Anna 2015-03-04 352 int id;
fb7737e949e31d Suman Anna 2015-03-04 353 int ret;
fb7737e949e31d Suman Anna 2015-03-04 354
fb7737e949e31d Suman Anna 2015-03-04 355 ret = of_parse_phandle_with_args(np, "hwlocks", "#hwlock-cells", index,
fb7737e949e31d Suman Anna 2015-03-04 356 &args);
fb7737e949e31d Suman Anna 2015-03-04 357 if (ret)
fb7737e949e31d Suman Anna 2015-03-04 358 return ret;
fb7737e949e31d Suman Anna 2015-03-04 359
fbd7330c9fd8ef Fabien Dessenne 2019-03-08 360 if (!of_device_is_available(args.np)) {
fbd7330c9fd8ef Fabien Dessenne 2019-03-08 361 ret = -ENOENT;
fbd7330c9fd8ef Fabien Dessenne 2019-03-08 362 goto out;
fbd7330c9fd8ef Fabien Dessenne 2019-03-08 363 }
fbd7330c9fd8ef Fabien Dessenne 2019-03-08 364
fb7737e949e31d Suman Anna 2015-03-04 365 /* Find the hwspinlock device: we need its base_id */
fb7737e949e31d Suman Anna 2015-03-04 366 ret = -EPROBE_DEFER;
fb7737e949e31d Suman Anna 2015-03-04 367 rcu_read_lock();
fb7737e949e31d Suman Anna 2015-03-04 @368 radix_tree_for_each_slot(slot, &hwspinlock_tree, &iter, 0) {
fb7737e949e31d Suman Anna 2015-03-04 @369 hwlock = radix_tree_deref_slot(slot);
fb7737e949e31d Suman Anna 2015-03-04 370 if (unlikely(!hwlock))
fb7737e949e31d Suman Anna 2015-03-04 371 continue;
b76ba4af4ddd6a Matthew Wilcox 2016-05-20 372 if (radix_tree_deref_retry(hwlock)) {
c6400ba7e13a41 Matthew Wilcox 2016-02-02 373 slot = radix_tree_iter_retry(&iter);
c6400ba7e13a41 Matthew Wilcox 2016-02-02 374 continue;
c6400ba7e13a41 Matthew Wilcox 2016-02-02 375 }
fb7737e949e31d Suman Anna 2015-03-04 376
fb7737e949e31d Suman Anna 2015-03-04 377 if (hwlock->bank->dev->of_node == args.np) {
fb7737e949e31d Suman Anna 2015-03-04 378 ret = 0;
fb7737e949e31d Suman Anna 2015-03-04 379 break;
fb7737e949e31d Suman Anna 2015-03-04 380 }
fb7737e949e31d Suman Anna 2015-03-04 381 }
fb7737e949e31d Suman Anna 2015-03-04 382 rcu_read_unlock();
fb7737e949e31d Suman Anna 2015-03-04 383 if (ret < 0)
fb7737e949e31d Suman Anna 2015-03-04 384 goto out;
fb7737e949e31d Suman Anna 2015-03-04 385
fb7737e949e31d Suman Anna 2015-03-04 386 id = of_hwspin_lock_simple_xlate(&args);
fb7737e949e31d Suman Anna 2015-03-04 387 if (id < 0 || id >= hwlock->bank->num_locks) {
fb7737e949e31d Suman Anna 2015-03-04 388 ret = -EINVAL;
fb7737e949e31d Suman Anna 2015-03-04 389 goto out;
fb7737e949e31d Suman Anna 2015-03-04 390 }
fb7737e949e31d Suman Anna 2015-03-04 391 id += hwlock->bank->base_id;
fb7737e949e31d Suman Anna 2015-03-04 392
fb7737e949e31d Suman Anna 2015-03-04 393 out:
fb7737e949e31d Suman Anna 2015-03-04 394 of_node_put(args.np);
fb7737e949e31d Suman Anna 2015-03-04 395 return ret ? ret : id;
fb7737e949e31d Suman Anna 2015-03-04 396 }
fb7737e949e31d Suman Anna 2015-03-04 397 EXPORT_SYMBOL_GPL(of_hwspin_lock_get_id);
fb7737e949e31d Suman Anna 2015-03-04 398

:::::: The code at line 369 was first introduced by commit
:::::: fb7737e949e31d8a71acee6bbb670f32dbd2a2c0 hwspinlock/core: add device tree support

:::::: TO: Suman Anna <s-anna@xxxxxx>
:::::: CC: Ohad Ben-Cohen <ohad@xxxxxxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx