drivers/gpu/drm/ttm/ttm_bo_util.c:465:28: sparse: sparse: incorrect type in argument 1 (different address spaces)

From: kernel test robot

Date: Sun Jun 14 2026 - 10:07:40 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: e21ee273e6fa3879aec9a27251cfce98156e07c4
commit: df75430515c33ece3de46562f917acd9792505ad drm: fix dead default for DRM_TTM_KUNIT_TEST
date: 3 months ago
config: nios2-randconfig-r131-20260614 (https://download.01.org/0day-ci/archive/20260614/202606142104.yLTxoIoB-lkp@xxxxxxxxx/config)
compiler: nios2-linux-gcc (GCC) 9.5.0
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260614/202606142104.yLTxoIoB-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Fixes: df75430515c3 ("drm: fix dead default for DRM_TTM_KUNIT_TEST")
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202606142104.yLTxoIoB-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
drivers/gpu/drm/ttm/ttm_bo_util.c:329:38: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected void *virtual @@ got void [noderef] __iomem * @@
drivers/gpu/drm/ttm/ttm_bo_util.c:329:38: sparse: expected void *virtual
drivers/gpu/drm/ttm/ttm_bo_util.c:329:38: sparse: got void [noderef] __iomem *
drivers/gpu/drm/ttm/ttm_bo_util.c:335:38: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected void *virtual @@ got void [noderef] __iomem * @@
drivers/gpu/drm/ttm/ttm_bo_util.c:335:38: sparse: expected void *virtual
drivers/gpu/drm/ttm/ttm_bo_util.c:335:38: sparse: got void [noderef] __iomem *
>> drivers/gpu/drm/ttm/ttm_bo_util.c:465:28: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void [noderef] __iomem *addr @@ got void *virtual @@
drivers/gpu/drm/ttm/ttm_bo_util.c:465:28: sparse: expected void [noderef] __iomem *addr
drivers/gpu/drm/ttm/ttm_bo_util.c:465:28: sparse: got void *virtual

vim +465 drivers/gpu/drm/ttm/ttm_bo_util.c

ba4e7d973dd09b6 Thomas Hellstrom 2009-06-10 451
a3185f91d0579b6 Christian König 2022-05-09 452 /**
a3185f91d0579b6 Christian König 2022-05-09 453 * ttm_bo_kunmap
a3185f91d0579b6 Christian König 2022-05-09 454 *
a3185f91d0579b6 Christian König 2022-05-09 455 * @map: Object describing the map to unmap.
a3185f91d0579b6 Christian König 2022-05-09 456 *
a3185f91d0579b6 Christian König 2022-05-09 457 * Unmaps a kernel map set up by ttm_bo_kmap.
a3185f91d0579b6 Christian König 2022-05-09 458 */
ba4e7d973dd09b6 Thomas Hellstrom 2009-06-10 459 void ttm_bo_kunmap(struct ttm_bo_kmap_obj *map)
ba4e7d973dd09b6 Thomas Hellstrom 2009-06-10 460 {
ba4e7d973dd09b6 Thomas Hellstrom 2009-06-10 461 if (!map->virtual)
ba4e7d973dd09b6 Thomas Hellstrom 2009-06-10 462 return;
ba4e7d973dd09b6 Thomas Hellstrom 2009-06-10 463 switch (map->bo_kmap_type) {
ba4e7d973dd09b6 Thomas Hellstrom 2009-06-10 464 case ttm_bo_map_iomap:
ba4e7d973dd09b6 Thomas Hellstrom 2009-06-10 @465 iounmap(map->virtual);
ba4e7d973dd09b6 Thomas Hellstrom 2009-06-10 466 break;
ba4e7d973dd09b6 Thomas Hellstrom 2009-06-10 467 case ttm_bo_map_vmap:
ba4e7d973dd09b6 Thomas Hellstrom 2009-06-10 468 vunmap(map->virtual);
ba4e7d973dd09b6 Thomas Hellstrom 2009-06-10 469 break;
ba4e7d973dd09b6 Thomas Hellstrom 2009-06-10 470 case ttm_bo_map_kmap:
ba4e7d973dd09b6 Thomas Hellstrom 2009-06-10 471 kunmap(map->page);
ba4e7d973dd09b6 Thomas Hellstrom 2009-06-10 472 break;
ba4e7d973dd09b6 Thomas Hellstrom 2009-06-10 473 case ttm_bo_map_premapped:
ba4e7d973dd09b6 Thomas Hellstrom 2009-06-10 474 break;
ba4e7d973dd09b6 Thomas Hellstrom 2009-06-10 475 default:
ba4e7d973dd09b6 Thomas Hellstrom 2009-06-10 476 BUG();
ba4e7d973dd09b6 Thomas Hellstrom 2009-06-10 477 }
d3116756a710e3c Christian König 2021-04-12 478 ttm_mem_io_free(map->bo->bdev, map->bo->resource);
ba4e7d973dd09b6 Thomas Hellstrom 2009-06-10 479 map->virtual = NULL;
ba4e7d973dd09b6 Thomas Hellstrom 2009-06-10 480 map->page = NULL;
ba4e7d973dd09b6 Thomas Hellstrom 2009-06-10 481 }
ba4e7d973dd09b6 Thomas Hellstrom 2009-06-10 482 EXPORT_SYMBOL(ttm_bo_kunmap);
ba4e7d973dd09b6 Thomas Hellstrom 2009-06-10 483

:::::: The code at line 465 was first introduced by commit
:::::: ba4e7d973dd09b66912ac4c0856add8b0703a997 drm: Add the TTM GPU memory manager subsystem.

:::::: TO: Thomas Hellstrom <thellstrom@xxxxxxxxxx>
:::::: CC: Dave Airlie <airlied@xxxxxxxxxx>

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki