drivers/mtd/maps/physmap-versatile.c:116:17: sparse: sparse: incorrect type in argument 1 (different address spaces)

From: kernel test robot
Date: Tue Aug 18 2020 - 07:12:55 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 06a4ec1d9dc652e17ee3ac2ceb6c7cf6c2b75cdd
commit: 670d0a4b10704667765f7d18f7592993d02783aa sparse: use identifiers to define address spaces
date: 9 weeks ago
config: openrisc-randconfig-s031-20200818 (attached as .config)
compiler: or1k-linux-gcc (GCC) 9.3.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.2-180-g49f7e13a-dirty
git checkout 670d0a4b10704667765f7d18f7592993d02783aa
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=openrisc

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/mtd/maps/physmap-versatile.c:116:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *addr @@ got void [noderef] __iomem *[assigned] ebi_base @@
drivers/mtd/maps/physmap-versatile.c:116:17: sparse: expected void *addr
>> drivers/mtd/maps/physmap-versatile.c:116:17: sparse: got void [noderef] __iomem *[assigned] ebi_base
drivers/mtd/maps/physmap-versatile.c: note: in included file (through arch/openrisc/include/asm/io.h, include/linux/io.h):
include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restricted __le32 [usertype] @@
include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value
include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype]
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restricted __le32 [usertype] @@
include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value
include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype]
include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restricted __le32 [usertype] @@
include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value
include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype]

# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=670d0a4b10704667765f7d18f7592993d02783aa
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 670d0a4b10704667765f7d18f7592993d02783aa
vim +116 drivers/mtd/maps/physmap-versatile.c

b0afd44bc192ff drivers/mtd/maps/physmap_of_versatile.c Linus Walleij 2016-01-26 82
b0afd44bc192ff drivers/mtd/maps/physmap_of_versatile.c Linus Walleij 2016-01-26 83 static int ap_flash_init(struct platform_device *pdev)
b0afd44bc192ff drivers/mtd/maps/physmap_of_versatile.c Linus Walleij 2016-01-26 84 {
b0afd44bc192ff drivers/mtd/maps/physmap_of_versatile.c Linus Walleij 2016-01-26 85 struct device_node *ebi;
ab8d531910e287 drivers/mtd/maps/physmap_of_versatile.c Julia Lawall 2017-07-15 86 void __iomem *ebi_base;
b0afd44bc192ff drivers/mtd/maps/physmap_of_versatile.c Linus Walleij 2016-01-26 87 u32 val;
b0afd44bc192ff drivers/mtd/maps/physmap_of_versatile.c Linus Walleij 2016-01-26 88 int ret;
b0afd44bc192ff drivers/mtd/maps/physmap_of_versatile.c Linus Walleij 2016-01-26 89
b0afd44bc192ff drivers/mtd/maps/physmap_of_versatile.c Linus Walleij 2016-01-26 90 /* Look up the EBI */
b0afd44bc192ff drivers/mtd/maps/physmap_of_versatile.c Linus Walleij 2016-01-26 91 ebi = of_find_matching_node(NULL, ebi_match);
b0afd44bc192ff drivers/mtd/maps/physmap_of_versatile.c Linus Walleij 2016-01-26 92 if (!ebi) {
b0afd44bc192ff drivers/mtd/maps/physmap_of_versatile.c Linus Walleij 2016-01-26 93 return -ENODEV;
b0afd44bc192ff drivers/mtd/maps/physmap_of_versatile.c Linus Walleij 2016-01-26 94 }
b0afd44bc192ff drivers/mtd/maps/physmap_of_versatile.c Linus Walleij 2016-01-26 95 ebi_base = of_iomap(ebi, 0);
b0afd44bc192ff drivers/mtd/maps/physmap_of_versatile.c Linus Walleij 2016-01-26 96 if (!ebi_base)
b0afd44bc192ff drivers/mtd/maps/physmap_of_versatile.c Linus Walleij 2016-01-26 97 return -ENODEV;
b0afd44bc192ff drivers/mtd/maps/physmap_of_versatile.c Linus Walleij 2016-01-26 98
b0afd44bc192ff drivers/mtd/maps/physmap_of_versatile.c Linus Walleij 2016-01-26 99 /* Clear VPP and write protection bits */
b0afd44bc192ff drivers/mtd/maps/physmap_of_versatile.c Linus Walleij 2016-01-26 100 ret = regmap_write(syscon_regmap,
b0afd44bc192ff drivers/mtd/maps/physmap_of_versatile.c Linus Walleij 2016-01-26 101 INTEGRATOR_SC_CTRLC_OFFSET,
b0afd44bc192ff drivers/mtd/maps/physmap_of_versatile.c Linus Walleij 2016-01-26 102 INTEGRATOR_SC_CTRL_FLVPPEN | INTEGRATOR_SC_CTRL_FLWP);
b0afd44bc192ff drivers/mtd/maps/physmap_of_versatile.c Linus Walleij 2016-01-26 103 if (ret)
b0afd44bc192ff drivers/mtd/maps/physmap_of_versatile.c Linus Walleij 2016-01-26 104 dev_err(&pdev->dev, "error clearing Integrator VPP/WP\n");
b0afd44bc192ff drivers/mtd/maps/physmap_of_versatile.c Linus Walleij 2016-01-26 105
b0afd44bc192ff drivers/mtd/maps/physmap_of_versatile.c Linus Walleij 2016-01-26 106 /* Unlock the EBI */
b0afd44bc192ff drivers/mtd/maps/physmap_of_versatile.c Linus Walleij 2016-01-26 107 writel(INTEGRATOR_EBI_LOCK_VAL, ebi_base + INTEGRATOR_EBI_LOCK_OFFSET);
b0afd44bc192ff drivers/mtd/maps/physmap_of_versatile.c Linus Walleij 2016-01-26 108
b0afd44bc192ff drivers/mtd/maps/physmap_of_versatile.c Linus Walleij 2016-01-26 109 /* Enable write cycles on the EBI, CSR1 (flash) */
b0afd44bc192ff drivers/mtd/maps/physmap_of_versatile.c Linus Walleij 2016-01-26 110 val = readl(ebi_base + INTEGRATOR_EBI_CSR1_OFFSET);
b0afd44bc192ff drivers/mtd/maps/physmap_of_versatile.c Linus Walleij 2016-01-26 111 val |= INTEGRATOR_EBI_WRITE_ENABLE;
b0afd44bc192ff drivers/mtd/maps/physmap_of_versatile.c Linus Walleij 2016-01-26 112 writel(val, ebi_base + INTEGRATOR_EBI_CSR1_OFFSET);
b0afd44bc192ff drivers/mtd/maps/physmap_of_versatile.c Linus Walleij 2016-01-26 113
b0afd44bc192ff drivers/mtd/maps/physmap_of_versatile.c Linus Walleij 2016-01-26 114 /* Lock the EBI again */
b0afd44bc192ff drivers/mtd/maps/physmap_of_versatile.c Linus Walleij 2016-01-26 115 writel(0, ebi_base + INTEGRATOR_EBI_LOCK_OFFSET);
b0afd44bc192ff drivers/mtd/maps/physmap_of_versatile.c Linus Walleij 2016-01-26 @116 iounmap(ebi_base);
b0afd44bc192ff drivers/mtd/maps/physmap_of_versatile.c Linus Walleij 2016-01-26 117
b0afd44bc192ff drivers/mtd/maps/physmap_of_versatile.c Linus Walleij 2016-01-26 118 return 0;
b0afd44bc192ff drivers/mtd/maps/physmap_of_versatile.c Linus Walleij 2016-01-26 119 }
b0afd44bc192ff drivers/mtd/maps/physmap_of_versatile.c Linus Walleij 2016-01-26 120

:::::: The code at line 116 was first introduced by commit
:::::: b0afd44bc192ff4c0e90a5fc1724350bcfc32b33 mtd: physmap_of: add a hook for Versatile write protection

:::::: TO: Linus Walleij <linus.walleij@xxxxxxxxxx>
:::::: CC: Linus Walleij <linus.walleij@xxxxxxxxxx>

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

Attachment: .config.gz
Description: application/gzip