drivers/mtd/devices/pmc551.c:783:53: sparse: sparse: incorrect type in argument 2 (different address spaces)

From: kernel test robot
Date: Tue Aug 18 2020 - 08:12:12 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: arm-randconfig-s032-20200818 (attached as .config)
compiler: arm-linux-gnueabi-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=arm

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/devices/pmc551.c:743:29: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected unsigned char [usertype] *start @@ got void [noderef] __iomem * @@
drivers/mtd/devices/pmc551.c:743:29: sparse: expected unsigned char [usertype] *start
drivers/mtd/devices/pmc551.c:743:29: sparse: got void [noderef] __iomem *
>> drivers/mtd/devices/pmc551.c:783:53: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] __iomem *addr @@ got unsigned char [usertype] *start @@
>> drivers/mtd/devices/pmc551.c:783:53: sparse: expected void [noderef] __iomem *addr
drivers/mtd/devices/pmc551.c:783:53: sparse: got unsigned char [usertype] *start
drivers/mtd/devices/pmc551.c:833:52: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] __iomem *addr @@ got unsigned char [usertype] *start @@
drivers/mtd/devices/pmc551.c:833:52: sparse: expected void [noderef] __iomem *addr
drivers/mtd/devices/pmc551.c:833:52: sparse: got unsigned char [usertype] *start

# 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 +783 drivers/mtd/devices/pmc551.c

^1da177e4c3f41 Linus Torvalds 2005-04-16 767
^1da177e4c3f41 Linus Torvalds 2005-04-16 768 mtd->size = msize;
^1da177e4c3f41 Linus Torvalds 2005-04-16 769 mtd->flags = MTD_CAP_RAM;
3c3c10bba1e4cc Artem Bityutskiy 2012-01-30 770 mtd->_erase = pmc551_erase;
3c3c10bba1e4cc Artem Bityutskiy 2012-01-30 771 mtd->_read = pmc551_read;
3c3c10bba1e4cc Artem Bityutskiy 2012-01-30 772 mtd->_write = pmc551_write;
3c3c10bba1e4cc Artem Bityutskiy 2012-01-30 773 mtd->_point = pmc551_point;
3c3c10bba1e4cc Artem Bityutskiy 2012-01-30 774 mtd->_unpoint = pmc551_unpoint;
^1da177e4c3f41 Linus Torvalds 2005-04-16 775 mtd->type = MTD_RAM;
^1da177e4c3f41 Linus Torvalds 2005-04-16 776 mtd->name = "PMC551 RAM board";
^1da177e4c3f41 Linus Torvalds 2005-04-16 777 mtd->erasesize = 0x10000;
17ffc7ba6d7ea6 Artem B. Bityutskiy 2006-06-22 778 mtd->writesize = 1;
^1da177e4c3f41 Linus Torvalds 2005-04-16 779 mtd->owner = THIS_MODULE;
^1da177e4c3f41 Linus Torvalds 2005-04-16 780
ee0e87b174bb41 Jamie Iles 2011-05-23 781 if (mtd_device_register(mtd, NULL, 0)) {
8e0aedc5bcb9da David Woodhouse 2007-06-29 782 printk(KERN_NOTICE "pmc551: Failed to register new device\n");
98aacdfde05ccf Jiri Slaby 2006-09-19 @783 pci_iounmap(PCI_Device, priv->start);
^1da177e4c3f41 Linus Torvalds 2005-04-16 784 kfree(mtd->priv);
^1da177e4c3f41 Linus Torvalds 2005-04-16 785 kfree(mtd);
^1da177e4c3f41 Linus Torvalds 2005-04-16 786 break;
^1da177e4c3f41 Linus Torvalds 2005-04-16 787 }
dd8e9ed6ed544e Alan Cox 2006-09-22 788
ee0e87b174bb41 Jamie Iles 2011-05-23 789 /* Keep a reference as the mtd_device_register worked */
dd8e9ed6ed544e Alan Cox 2006-09-22 790 pci_dev_get(PCI_Device);
dd8e9ed6ed544e Alan Cox 2006-09-22 791
^1da177e4c3f41 Linus Torvalds 2005-04-16 792 printk(KERN_NOTICE "Registered pmc551 memory device.\n");
8e0aedc5bcb9da David Woodhouse 2007-06-29 793 printk(KERN_NOTICE "Mapped %dMiB of memory from 0x%p to 0x%p\n",
^1da177e4c3f41 Linus Torvalds 2005-04-16 794 priv->asize >> 20,
cdf0a7d1698085 Jiri Slaby 2006-09-19 795 priv->start, priv->start + priv->asize);
8e0aedc5bcb9da David Woodhouse 2007-06-29 796 printk(KERN_NOTICE "Total memory is %d%sB\n",
^1da177e4c3f41 Linus Torvalds 2005-04-16 797 (length < 1024) ? length :
^1da177e4c3f41 Linus Torvalds 2005-04-16 798 (length < 1048576) ? length >> 10 : length >> 20,
8e0aedc5bcb9da David Woodhouse 2007-06-29 799 (length < 1024) ? "" : (length < 1048576) ? "Ki" : "Mi");
^1da177e4c3f41 Linus Torvalds 2005-04-16 800 priv->nextpmc551 = pmc551list;
^1da177e4c3f41 Linus Torvalds 2005-04-16 801 pmc551list = mtd;
^1da177e4c3f41 Linus Torvalds 2005-04-16 802 found++;
^1da177e4c3f41 Linus Torvalds 2005-04-16 803 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 804
dd8e9ed6ed544e Alan Cox 2006-09-22 805 /* Exited early, reference left over */
dd8e9ed6ed544e Alan Cox 2006-09-22 806 pci_dev_put(PCI_Device);
dd8e9ed6ed544e Alan Cox 2006-09-22 807
^1da177e4c3f41 Linus Torvalds 2005-04-16 808 if (!pmc551list) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 809 printk(KERN_NOTICE "pmc551: not detected\n");
^1da177e4c3f41 Linus Torvalds 2005-04-16 810 return -ENODEV;
^1da177e4c3f41 Linus Torvalds 2005-04-16 811 } else {
^1da177e4c3f41 Linus Torvalds 2005-04-16 812 printk(KERN_NOTICE "pmc551: %d pmc551 devices loaded\n", found);
^1da177e4c3f41 Linus Torvalds 2005-04-16 813 return 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 814 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 815 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 816

:::::: The code at line 783 was first introduced by commit
:::::: 98aacdfde05ccf512d4395eed0d4894eea2d163c [MTD] pmc551 pci cleanup

:::::: TO: Jiri Slaby <jirislaby@xxxxxxxxx>
:::::: CC: David Woodhouse <dwmw2@xxxxxxxxxxxxx>

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

Attachment: .config.gz
Description: application/gzip