drivers/remoteproc/imx_rproc.c:298:12: sparse: sparse: incorrect type in assignment (different address spaces)

From: kernel test robot
Date: Mon Dec 13 2021 - 09:15:00 EST


Hi Peng,

First bad commit (maybe != root cause):

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 2585cf9dfaaddf00b069673f27bb3f8530e2039c
commit: 2df7062002d0263bde70b453f671bb4f8493e169 remoteproc: imx_proc: enable virtio/mailbox
date: 9 months ago
config: arm-allyesconfig (https://download.01.org/0day-ci/archive/20211213/202112132256.jCxIHiiN-lkp@xxxxxxxxx/config)
compiler: arm-linux-gnueabi-gcc (GCC) 11.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=2df7062002d0263bde70b453f671bb4f8493e169
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 2df7062002d0263bde70b453f671bb4f8493e169
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=arm SHELL=/bin/bash drivers/dma/ drivers/gpu/drm/tegra/ drivers/net/wireless/mediatek/mt76/mt7915/ drivers/remoteproc/ drivers/staging/ fs/proc/

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/remoteproc/imx_rproc.c:298:12: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected void *va @@ got void [noderef] __iomem * @@
drivers/remoteproc/imx_rproc.c:298:12: sparse: expected void *va
drivers/remoteproc/imx_rproc.c:298:12: sparse: got void [noderef] __iomem *
>> drivers/remoteproc/imx_rproc.c:315:20: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void volatile [noderef] __iomem *iomem_cookie @@ got void *va @@
drivers/remoteproc/imx_rproc.c:315:20: sparse: expected void volatile [noderef] __iomem *iomem_cookie
drivers/remoteproc/imx_rproc.c:315:20: sparse: got void *va

vim +298 drivers/remoteproc/imx_rproc.c

a0ff4aa6f01080 Oleksij Rempel 2017-08-17 290
b29b4249f8f0ca Peng Fan 2021-03-06 291 static int imx_rproc_mem_alloc(struct rproc *rproc,
b29b4249f8f0ca Peng Fan 2021-03-06 292 struct rproc_mem_entry *mem)
b29b4249f8f0ca Peng Fan 2021-03-06 293 {
b29b4249f8f0ca Peng Fan 2021-03-06 294 struct device *dev = rproc->dev.parent;
b29b4249f8f0ca Peng Fan 2021-03-06 295 void *va;
b29b4249f8f0ca Peng Fan 2021-03-06 296
b29b4249f8f0ca Peng Fan 2021-03-06 297 dev_dbg(dev, "map memory: %p+%zx\n", &mem->dma, mem->len);
b29b4249f8f0ca Peng Fan 2021-03-06 @298 va = ioremap_wc(mem->dma, mem->len);
b29b4249f8f0ca Peng Fan 2021-03-06 299 if (IS_ERR_OR_NULL(va)) {
b29b4249f8f0ca Peng Fan 2021-03-06 300 dev_err(dev, "Unable to map memory region: %p+%zx\n",
b29b4249f8f0ca Peng Fan 2021-03-06 301 &mem->dma, mem->len);
b29b4249f8f0ca Peng Fan 2021-03-06 302 return -ENOMEM;
b29b4249f8f0ca Peng Fan 2021-03-06 303 }
b29b4249f8f0ca Peng Fan 2021-03-06 304
b29b4249f8f0ca Peng Fan 2021-03-06 305 /* Update memory entry va */
b29b4249f8f0ca Peng Fan 2021-03-06 306 mem->va = va;
b29b4249f8f0ca Peng Fan 2021-03-06 307
b29b4249f8f0ca Peng Fan 2021-03-06 308 return 0;
b29b4249f8f0ca Peng Fan 2021-03-06 309 }
b29b4249f8f0ca Peng Fan 2021-03-06 310
b29b4249f8f0ca Peng Fan 2021-03-06 311 static int imx_rproc_mem_release(struct rproc *rproc,
b29b4249f8f0ca Peng Fan 2021-03-06 312 struct rproc_mem_entry *mem)
b29b4249f8f0ca Peng Fan 2021-03-06 313 {
b29b4249f8f0ca Peng Fan 2021-03-06 314 dev_dbg(rproc->dev.parent, "unmap memory: %pa\n", &mem->dma);
b29b4249f8f0ca Peng Fan 2021-03-06 @315 iounmap(mem->va);
b29b4249f8f0ca Peng Fan 2021-03-06 316
b29b4249f8f0ca Peng Fan 2021-03-06 317 return 0;
b29b4249f8f0ca Peng Fan 2021-03-06 318 }
b29b4249f8f0ca Peng Fan 2021-03-06 319

:::::: The code at line 298 was first introduced by commit
:::::: b29b4249f8f0cad1a1787cbe59e638ff23d489ed remoteproc: imx_rproc: add i.MX specific parse fw hook

:::::: TO: Peng Fan <peng.fan@xxxxxxx>
:::::: CC: Bjorn Andersson <bjorn.andersson@xxxxxxxxxx>

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