drivers/ata/pata_buddha.c:75:27: sparse: sparse: incorrect type in argument 1 (different address spaces)

From: kernel test robot
Date: Fri Dec 15 2023 - 11:07:22 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 3f7168591ebf7bbdb91797d02b1afaf00a4289b1
commit: c7db3832ff19a9a1116c1b3d435c9db165a2f2f8 m68k: io: Mark mmio read addresses as const
date: 2 months ago
config: m68k-randconfig-r113-20231215 (https://download.01.org/0day-ci/archive/20231215/202312152310.PfrGc8IR-lkp@xxxxxxxxx/config)
compiler: m68k-linux-gcc (GCC) 13.2.0
reproduce: (https://download.01.org/0day-ci/archive/20231215/202312152310.PfrGc8IR-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
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202312152310.PfrGc8IR-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
drivers/ata/pata_buddha.c:75:27: sparse: sparse: cast removes address space '__iomem' of expression
>> drivers/ata/pata_buddha.c:75:27: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected unsigned short const volatile [noderef] [usertype] __iomem *port @@ got unsigned short [usertype] * @@
drivers/ata/pata_buddha.c:75:27: sparse: expected unsigned short const volatile [noderef] [usertype] __iomem *port
drivers/ata/pata_buddha.c:75:27: sparse: got unsigned short [usertype] *
drivers/ata/pata_buddha.c:77:28: sparse: sparse: cast removes address space '__iomem' of expression
drivers/ata/pata_buddha.c:77:28: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected unsigned short volatile [noderef] [usertype] __iomem *port @@ got unsigned short [usertype] * @@
drivers/ata/pata_buddha.c:77:28: sparse: expected unsigned short volatile [noderef] [usertype] __iomem *port
drivers/ata/pata_buddha.c:77:28: sparse: got unsigned short [usertype] *
drivers/ata/pata_buddha.c:87:35: sparse: sparse: cast removes address space '__iomem' of expression
drivers/ata/pata_buddha.c:87:35: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected unsigned short const volatile [noderef] [usertype] __iomem *port @@ got unsigned short [usertype] * @@
drivers/ata/pata_buddha.c:87:35: sparse: expected unsigned short const volatile [noderef] [usertype] __iomem *port
drivers/ata/pata_buddha.c:87:35: sparse: got unsigned short [usertype] *
drivers/ata/pata_buddha.c:91:36: sparse: sparse: cast removes address space '__iomem' of expression
drivers/ata/pata_buddha.c:91:36: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected unsigned short volatile [noderef] [usertype] __iomem *port @@ got unsigned short [usertype] * @@
drivers/ata/pata_buddha.c:91:36: sparse: expected unsigned short volatile [noderef] [usertype] __iomem *port
drivers/ata/pata_buddha.c:91:36: sparse: got unsigned short [usertype] *
drivers/ata/pata_buddha.c:236:37: sparse: sparse: cast removes address space '__iomem' of expression
--
drivers/ata/pata_gayle.c:53:27: sparse: sparse: cast removes address space '__iomem' of expression
>> drivers/ata/pata_gayle.c:53:27: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected unsigned short const volatile [noderef] [usertype] __iomem *port @@ got unsigned short [usertype] * @@
drivers/ata/pata_gayle.c:53:27: sparse: expected unsigned short const volatile [noderef] [usertype] __iomem *port
drivers/ata/pata_gayle.c:53:27: sparse: got unsigned short [usertype] *
drivers/ata/pata_gayle.c:55:28: sparse: sparse: cast removes address space '__iomem' of expression
drivers/ata/pata_gayle.c:55:28: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected unsigned short volatile [noderef] [usertype] __iomem *port @@ got unsigned short [usertype] * @@
drivers/ata/pata_gayle.c:55:28: sparse: expected unsigned short volatile [noderef] [usertype] __iomem *port
drivers/ata/pata_gayle.c:55:28: sparse: got unsigned short [usertype] *
drivers/ata/pata_gayle.c:65:35: sparse: sparse: cast removes address space '__iomem' of expression
drivers/ata/pata_gayle.c:65:35: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected unsigned short const volatile [noderef] [usertype] __iomem *port @@ got unsigned short [usertype] * @@
drivers/ata/pata_gayle.c:65:35: sparse: expected unsigned short const volatile [noderef] [usertype] __iomem *port
drivers/ata/pata_gayle.c:65:35: sparse: got unsigned short [usertype] *
drivers/ata/pata_gayle.c:69:36: sparse: sparse: cast removes address space '__iomem' of expression
drivers/ata/pata_gayle.c:69:36: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected unsigned short volatile [noderef] [usertype] __iomem *port @@ got unsigned short [usertype] * @@
drivers/ata/pata_gayle.c:69:36: sparse: expected unsigned short volatile [noderef] [usertype] __iomem *port
drivers/ata/pata_gayle.c:69:36: sparse: got unsigned short [usertype] *
drivers/ata/pata_gayle.c:181:29: sparse: sparse: cast removes address space '__iomem' of expression

vim +75 drivers/ata/pata_buddha.c

740c68a0cd42aa Bartlomiej Zolnierkiewicz 2019-02-07 62
740c68a0cd42aa Bartlomiej Zolnierkiewicz 2019-02-07 63 /* FIXME: is this needed? */
740c68a0cd42aa Bartlomiej Zolnierkiewicz 2019-02-07 64 static unsigned int pata_buddha_data_xfer(struct ata_queued_cmd *qc,
740c68a0cd42aa Bartlomiej Zolnierkiewicz 2019-02-07 65 unsigned char *buf,
740c68a0cd42aa Bartlomiej Zolnierkiewicz 2019-02-07 66 unsigned int buflen, int rw)
740c68a0cd42aa Bartlomiej Zolnierkiewicz 2019-02-07 67 {
740c68a0cd42aa Bartlomiej Zolnierkiewicz 2019-02-07 68 struct ata_device *dev = qc->dev;
740c68a0cd42aa Bartlomiej Zolnierkiewicz 2019-02-07 69 struct ata_port *ap = dev->link->ap;
740c68a0cd42aa Bartlomiej Zolnierkiewicz 2019-02-07 70 void __iomem *data_addr = ap->ioaddr.data_addr;
740c68a0cd42aa Bartlomiej Zolnierkiewicz 2019-02-07 71 unsigned int words = buflen >> 1;
740c68a0cd42aa Bartlomiej Zolnierkiewicz 2019-02-07 72
740c68a0cd42aa Bartlomiej Zolnierkiewicz 2019-02-07 73 /* Transfer multiple of 2 bytes */
740c68a0cd42aa Bartlomiej Zolnierkiewicz 2019-02-07 74 if (rw == READ)
740c68a0cd42aa Bartlomiej Zolnierkiewicz 2019-02-07 @75 raw_insw((u16 *)data_addr, (u16 *)buf, words);
740c68a0cd42aa Bartlomiej Zolnierkiewicz 2019-02-07 76 else
740c68a0cd42aa Bartlomiej Zolnierkiewicz 2019-02-07 77 raw_outsw((u16 *)data_addr, (u16 *)buf, words);
740c68a0cd42aa Bartlomiej Zolnierkiewicz 2019-02-07 78
740c68a0cd42aa Bartlomiej Zolnierkiewicz 2019-02-07 79 /* Transfer trailing byte, if any. */
740c68a0cd42aa Bartlomiej Zolnierkiewicz 2019-02-07 80 if (unlikely(buflen & 0x01)) {
740c68a0cd42aa Bartlomiej Zolnierkiewicz 2019-02-07 81 unsigned char pad[2] = { };
740c68a0cd42aa Bartlomiej Zolnierkiewicz 2019-02-07 82
740c68a0cd42aa Bartlomiej Zolnierkiewicz 2019-02-07 83 /* Point buf to the tail of buffer */
740c68a0cd42aa Bartlomiej Zolnierkiewicz 2019-02-07 84 buf += buflen - 1;
740c68a0cd42aa Bartlomiej Zolnierkiewicz 2019-02-07 85
740c68a0cd42aa Bartlomiej Zolnierkiewicz 2019-02-07 86 if (rw == READ) {
740c68a0cd42aa Bartlomiej Zolnierkiewicz 2019-02-07 87 raw_insw((u16 *)data_addr, (u16 *)pad, 1);
740c68a0cd42aa Bartlomiej Zolnierkiewicz 2019-02-07 88 *buf = pad[0];
740c68a0cd42aa Bartlomiej Zolnierkiewicz 2019-02-07 89 } else {
740c68a0cd42aa Bartlomiej Zolnierkiewicz 2019-02-07 90 pad[0] = *buf;
740c68a0cd42aa Bartlomiej Zolnierkiewicz 2019-02-07 91 raw_outsw((u16 *)data_addr, (u16 *)pad, 1);
740c68a0cd42aa Bartlomiej Zolnierkiewicz 2019-02-07 92 }
740c68a0cd42aa Bartlomiej Zolnierkiewicz 2019-02-07 93 words++;
740c68a0cd42aa Bartlomiej Zolnierkiewicz 2019-02-07 94 }
740c68a0cd42aa Bartlomiej Zolnierkiewicz 2019-02-07 95
740c68a0cd42aa Bartlomiej Zolnierkiewicz 2019-02-07 96 return words << 1;
740c68a0cd42aa Bartlomiej Zolnierkiewicz 2019-02-07 97 }
740c68a0cd42aa Bartlomiej Zolnierkiewicz 2019-02-07 98

:::::: The code at line 75 was first introduced by commit
:::::: 740c68a0cd42aab21ad9aaae092ff8a2215966b1 ata: add Buddha PATA controller driver

:::::: TO: Bartlomiej Zolnierkiewicz <b.zolnierkie@xxxxxxxxxxx>
:::::: CC: Jens Axboe <axboe@xxxxxxxxx>

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