drivers/spi/spi-aspeed-smc.c:909:35: sparse: sparse: incorrect type in argument 2 (different address spaces)
From: kernel test robot
Date: Mon Mar 02 2026 - 03:52:55 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 11439c4635edd669ae435eec308f4ab8a0804808
commit: 04f7516ab70f7b82aae1d2830af2ee6f17f3fe98 spi: aspeed: Add support for non-spi-mem devices
date: 5 weeks ago
config: openrisc-randconfig-r111-20260302 (https://download.01.org/0day-ci/archive/20260302/202603021656.vpe2bWbn-lkp@xxxxxxxxx/config)
compiler: or1k-linux-gcc (GCC) 14.3.0
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260302/202603021656.vpe2bWbn-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/202603021656.vpe2bWbn-lkp@xxxxxxxxx/
sparse warnings: (new ones prefixed by >>)
>> drivers/spi/spi-aspeed-smc.c:909:35: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile [noderef] __iomem *addr @@ got void *dst @@
drivers/spi/spi-aspeed-smc.c:909:35: sparse: expected void volatile [noderef] __iomem *addr
drivers/spi/spi-aspeed-smc.c:909:35: sparse: got void *dst
>> drivers/spi/spi-aspeed-smc.c:939:46: sparse: sparse: cast removes address space '__iomem' of expression
drivers/spi/spi-aspeed-smc.c:1469:61: sparse: sparse: undefined identifier 'cols'
drivers/spi/spi-aspeed-smc.c:1469:61: sparse: sparse: bad constant expression type
drivers/spi/spi-aspeed-smc.c:1469:55: sparse: sparse: undefined identifier 'rows'
drivers/spi/spi-aspeed-smc.c:1469:55: sparse: sparse: bad constant expression type
vim +909 drivers/spi/spi-aspeed-smc.c
890
891 static void aspeed_spi_user_transfer_tx(struct aspeed_spi *aspi,
892 struct spi_device *spi,
893 const u8 *tx_buf, u8 *rx_buf,
894 void *dst, u32 len)
895 {
896 const struct aspeed_spi_data *data = aspi->data;
897 bool full_duplex_transfer = data->full_duplex && tx_buf == rx_buf;
898 u32 i;
899
900 if (full_duplex_transfer &&
901 !!(spi->mode & (SPI_TX_DUAL | SPI_TX_QUAD |
902 SPI_RX_DUAL | SPI_RX_QUAD))) {
903 dev_err(aspi->dev,
904 "full duplex is only supported for single IO mode\n");
905 return;
906 }
907
908 for (i = 0; i < len; i++) {
> 909 writeb(tx_buf[i], dst);
910 if (full_duplex_transfer)
911 rx_buf[i] = readb(aspi->regs + FULL_DUPLEX_RX_DATA);
912 }
913 }
914
915 static int aspeed_spi_user_transfer(struct spi_controller *ctlr,
916 struct spi_device *spi,
917 struct spi_transfer *xfer)
918 {
919 struct aspeed_spi *aspi =
920 (struct aspeed_spi *)spi_controller_get_devdata(ctlr);
921 u32 cs = spi_get_chipselect(spi, 0);
922 struct aspeed_spi_chip *chip = &aspi->chips[cs];
923 void __iomem *ahb_base = aspi->chips[cs].ahb_base;
924 const u8 *tx_buf = xfer->tx_buf;
925 u8 *rx_buf = xfer->rx_buf;
926
927 dev_dbg(aspi->dev,
928 "[cs%d] xfer: width %d, len %u, tx %p, rx %p\n",
929 cs, xfer->bits_per_word, xfer->len,
930 tx_buf, rx_buf);
931
932 if (tx_buf) {
933 if (spi->mode & SPI_TX_DUAL)
934 aspeed_spi_set_io_mode(chip, CTRL_IO_DUAL_DATA);
935 else if (spi->mode & SPI_TX_QUAD)
936 aspeed_spi_set_io_mode(chip, CTRL_IO_QUAD_DATA);
937
938 aspeed_spi_user_transfer_tx(aspi, spi, tx_buf, rx_buf,
> 939 (void *)ahb_base, xfer->len);
940 }
941
942 if (rx_buf && rx_buf != tx_buf) {
943 if (spi->mode & SPI_RX_DUAL)
944 aspeed_spi_set_io_mode(chip, CTRL_IO_DUAL_DATA);
945 else if (spi->mode & SPI_RX_QUAD)
946 aspeed_spi_set_io_mode(chip, CTRL_IO_QUAD_DATA);
947
948 ioread8_rep(ahb_base, rx_buf, xfer->len);
949 }
950
951 xfer->error = 0;
952 aspi->cs_change = xfer->cs_change;
953
954 return 0;
955 }
956
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki