drivers/mtd/nand/raw/hisi504_nand.c:465:17: sparse: sparse: incorrect type in argument 1 (different address spaces)

kernel test robot
2022-04-14T12:51:45Z

head: a19944809fe9942e6a96292490717904d0690c21
commit: 28e77cc1c0686621a4d416f599cee5ab369daa0a fortify: Detect struct member overflows in memset() at compile-time
date: 9 weeks ago
config: arm-randconfig-s031-20220414 (https://download.01.org/0day-ci/archive/20220414/202204142012.odIft7m9-lkp@intel.com/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=28e77cc1c0686621a4d416f599cee5ab369daa0a
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 28e77cc1c0686621a4d416f599cee5ab369daa0a
# 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/mtd/nand/raw/ drivers/video/fbdev/ fs/

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

sparse warnings: (new ones prefixed by >>)
drivers/mtd/nand/raw/hisi504_nand.c:362:26: sparse: sparse: cast removes address space '__iomem' of expression
drivers/mtd/nand/raw/hisi504_nand.c:367:26: sparse: sparse: cast removes address space '__iomem' of expression
>> drivers/mtd/nand/raw/hisi504_nand.c:465:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const * @@ got void [noderef] __iomem *mmio @@
drivers/mtd/nand/raw/hisi504_nand.c:465:17: sparse: expected void const *
drivers/mtd/nand/raw/hisi504_nand.c:465:17: sparse: got void [noderef] __iomem *mmio
>> drivers/mtd/nand/raw/hisi504_nand.c:465:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const * @@ got void [noderef] __iomem *mmio @@
drivers/mtd/nand/raw/hisi504_nand.c:465:17: sparse: expected void const *
drivers/mtd/nand/raw/hisi504_nand.c:465:17: sparse: got void [noderef] __iomem *mmio
drivers/mtd/nand/raw/hisi504_nand.c:465:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void * @@ got void [noderef] __iomem *mmio @@
drivers/mtd/nand/raw/hisi504_nand.c:465:17: sparse: expected void *
drivers/mtd/nand/raw/hisi504_nand.c:465:17: sparse: got void [noderef] __iomem *mmio
drivers/mtd/nand/raw/hisi504_nand.c:477:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const * @@ got void [noderef] __iomem *mmio @@
drivers/mtd/nand/raw/hisi504_nand.c:477:17: sparse: expected void const *
drivers/mtd/nand/raw/hisi504_nand.c:477:17: sparse: got void [noderef] __iomem *mmio
drivers/mtd/nand/raw/hisi504_nand.c:477:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const * @@ got void [noderef] __iomem *mmio @@
drivers/mtd/nand/raw/hisi504_nand.c:477:17: sparse: expected void const *
drivers/mtd/nand/raw/hisi504_nand.c:477:17: sparse: got void [noderef] __iomem *mmio
drivers/mtd/nand/raw/hisi504_nand.c:477:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void * @@ got void [noderef] __iomem *mmio @@
drivers/mtd/nand/raw/hisi504_nand.c:477:17: sparse: expected void *
drivers/mtd/nand/raw/hisi504_nand.c:477:17: sparse: got void [noderef] __iomem *mmio
drivers/mtd/nand/raw/hisi504_nand.c:603:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const * @@ got void [noderef] __iomem *mmio @@
drivers/mtd/nand/raw/hisi504_nand.c:603:9: sparse: expected void const *
drivers/mtd/nand/raw/hisi504_nand.c:603:9: sparse: got void [noderef] __iomem *mmio
drivers/mtd/nand/raw/hisi504_nand.c:603:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const * @@ got void [noderef] __iomem *mmio @@
drivers/mtd/nand/raw/hisi504_nand.c:603:9: sparse: expected void const *
drivers/mtd/nand/raw/hisi504_nand.c:603:9: sparse: got void [noderef] __iomem *mmio
drivers/mtd/nand/raw/hisi504_nand.c:603:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void * @@ got void [noderef] __iomem *mmio @@
drivers/mtd/nand/raw/hisi504_nand.c:603:9: sparse: expected void *
drivers/mtd/nand/raw/hisi504_nand.c:603:9: sparse: got void [noderef] __iomem *mmio
--
drivers/video/fbdev/s3c2410fb.c:643:27: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected char [noderef] __iomem *screen_base @@ got void * @@
drivers/video/fbdev/s3c2410fb.c:643:27: sparse: expected char [noderef] __iomem *screen_base
drivers/video/fbdev/s3c2410fb.c:643:27: sparse: got void *
>> drivers/video/fbdev/s3c2410fb.c:650:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const * @@ got char [noderef] __iomem *screen_base @@
drivers/video/fbdev/s3c2410fb.c:650:17: sparse: expected void const *
drivers/video/fbdev/s3c2410fb.c:650:17: sparse: got char [noderef] __iomem *screen_base
>> drivers/video/fbdev/s3c2410fb.c:650:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const * @@ got char [noderef] __iomem *screen_base @@
drivers/video/fbdev/s3c2410fb.c:650:17: sparse: expected void const *
drivers/video/fbdev/s3c2410fb.c:650:17: sparse: got char [noderef] __iomem *screen_base
>> drivers/video/fbdev/s3c2410fb.c:650:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void * @@ got char [noderef] __iomem *screen_base @@
drivers/video/fbdev/s3c2410fb.c:650:17: sparse: expected void *
drivers/video/fbdev/s3c2410fb.c:650:17: sparse: got char [noderef] __iomem *screen_base
drivers/video/fbdev/s3c2410fb.c:666:25: sparse: sparse: incorrect type in argument 3 (different address spaces) @@ expected void *cpu_addr @@ got char [noderef] __iomem *screen_base @@
drivers/video/fbdev/s3c2410fb.c:666:25: sparse: expected void *cpu_addr
drivers/video/fbdev/s3c2410fb.c:666:25: sparse: got char [noderef] __iomem *screen_base
drivers/video/fbdev/s3c2410fb.c:666:25: sparse: sparse: incorrect type in argument 3 (different address spaces) @@ expected void *cpu_addr @@ got char [noderef] __iomem *screen_base @@
drivers/video/fbdev/s3c2410fb.c:666:25: sparse: expected void *cpu_addr
drivers/video/fbdev/s3c2410fb.c:666:25: sparse: got char [noderef] __iomem *screen_base

vim +465 drivers/mtd/nand/raw/hisi504_nand.c

54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 356
7e534323c41621 drivers/mtd/nand/raw/hisi504_nand.c Boris Brezillon 2018-09-06 357 static uint8_t hisi_nfc_read_byte(struct nand_chip *chip)
54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 358 {
d699ed250c0738 drivers/mtd/nand/hisi504_nand.c Boris Brezillon 2015-12-10 359 struct hinfc_host *host = nand_get_controller_data(chip);
54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 360
54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 361 if (host->command == NAND_CMD_STATUS)
54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 @362 return *(uint8_t *)(host->mmio);
54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 363
54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 364 host->offset++;
54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 365
54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 366 if (host->command == NAND_CMD_READID)
54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 367 return *(uint8_t *)(host->mmio + host->offset - 1);
54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 368
54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 369 return *(uint8_t *)(host->buffer + host->offset - 1);
54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 370 }
54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 371
54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 372 static void
c0739d85723a38 drivers/mtd/nand/raw/hisi504_nand.c Boris Brezillon 2018-09-06 373 hisi_nfc_write_buf(struct nand_chip *chip, const uint8_t *buf, int len)
54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 374 {
d699ed250c0738 drivers/mtd/nand/hisi504_nand.c Boris Brezillon 2015-12-10 375 struct hinfc_host *host = nand_get_controller_data(chip);
54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 376
54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 377 memcpy(host->buffer + host->offset, buf, len);
54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 378 host->offset += len;
54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 379 }
54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 380
7e534323c41621 drivers/mtd/nand/raw/hisi504_nand.c Boris Brezillon 2018-09-06 381 static void hisi_nfc_read_buf(struct nand_chip *chip, uint8_t *buf, int len)
54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 382 {
d699ed250c0738 drivers/mtd/nand/hisi504_nand.c Boris Brezillon 2015-12-10 383 struct hinfc_host *host = nand_get_controller_data(chip);
54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 384
54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 385 memcpy(buf, host->buffer + host->offset, len);
54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 386 host->offset += len;
54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 387 }
54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 388
54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 389 static void set_addr(struct mtd_info *mtd, int column, int page_addr)
54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 390 {
4bd4ebcc540c35 drivers/mtd/nand/hisi504_nand.c Boris Brezillon 2015-12-01 391 struct nand_chip *chip = mtd_to_nand(mtd);
d699ed250c0738 drivers/mtd/nand/hisi504_nand.c Boris Brezillon 2015-12-10 392 struct hinfc_host *host = nand_get_controller_data(chip);
54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 393 unsigned int command = host->command;
54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 394
54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 395 host->addr_cycle = 0;
54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 396 host->addr_value[0] = 0;
54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 397 host->addr_value[1] = 0;
54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 398
54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 399 /* Serially input address */
54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 400 if (column != -1) {
54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 401 /* Adjust columns for 16 bit buswidth */
54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 402 if (chip->options & NAND_BUSWIDTH_16 &&
54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 403 !nand_opcode_8bits(command))
54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 404 column >>= 1;
54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 405
54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 406 host->addr_value[0] = column & 0xffff;
54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 407 host->addr_cycle = 2;
54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 408 }
54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 409 if (page_addr != -1) {
54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 410 host->addr_value[0] |= (page_addr & 0xffff)
54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 411 << (host->addr_cycle * 8);
54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 412 host->addr_cycle += 2;
14157f861437eb drivers/mtd/nand/hisi504_nand.c Masahiro Yamada 2017-09-13 413 if (chip->options & NAND_ROW_ADDR_3) {
54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 414 host->addr_cycle += 1;
54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 415 if (host->command == NAND_CMD_ERASE1)
54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 416 host->addr_value[0] |= ((page_addr >> 16) & 0xff) << 16;
54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 417 else
54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 418 host->addr_value[1] |= ((page_addr >> 16) & 0xff);
54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 419 }
54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 420 }
54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 421 }