drivers/spi/spi-ti-qspi.c:266:38: sparse: sparse: incorrect type in assignment (different base types)
From: kernel test robot
Date: Fri Dec 12 2025 - 08:17:57 EST
Hi Tiwei,
First bad commit (maybe != root cause):
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: d358e5254674b70f34c847715ca509e46eb81e6f
commit: a0e2cb6a90634f3dc80f16e882a683ee5761b0b0 um: Add VFIO-based virtual PCI driver
date: 7 months ago
config: um-randconfig-r121-20251212 (https://download.01.org/0day-ci/archive/20251212/202512122110.ZdyWcFXR-lkp@xxxxxxxxx/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251212/202512122110.ZdyWcFXR-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/202512122110.ZdyWcFXR-lkp@xxxxxxxxx/
sparse warnings: (new ones prefixed by >>)
>> drivers/spi/spi-ti-qspi.c:266:38: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] data @@ got restricted __be32 [usertype] @@
drivers/spi/spi-ti-qspi.c:266:38: sparse: expected unsigned int [usertype] data
drivers/spi/spi-ti-qspi.c:266:38: sparse: got restricted __be32 [usertype]
drivers/spi/spi-ti-qspi.c:269:38: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] data @@ got restricted __be32 [usertype] @@
drivers/spi/spi-ti-qspi.c:269:38: sparse: expected unsigned int [usertype] data
drivers/spi/spi-ti-qspi.c:269:38: sparse: got restricted __be32 [usertype]
drivers/spi/spi-ti-qspi.c:272:38: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] data @@ got restricted __be32 [usertype] @@
drivers/spi/spi-ti-qspi.c:272:38: sparse: expected unsigned int [usertype] data
drivers/spi/spi-ti-qspi.c:272:38: sparse: got restricted __be32 [usertype]
drivers/spi/spi-ti-qspi.c:275:38: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] data @@ got restricted __be32 [usertype] @@
drivers/spi/spi-ti-qspi.c:275:38: sparse: expected unsigned int [usertype] data
drivers/spi/spi-ti-qspi.c:275:38: sparse: got restricted __be32 [usertype]
drivers/spi/spi-ti-qspi.c:376:42: sparse: sparse: cast to restricted __be32
drivers/spi/spi-ti-qspi.c:376:42: sparse: sparse: cast to restricted __be32
drivers/spi/spi-ti-qspi.c:376:42: sparse: sparse: cast to restricted __be32
drivers/spi/spi-ti-qspi.c:376:42: sparse: sparse: cast to restricted __be32
drivers/spi/spi-ti-qspi.c:376:42: sparse: sparse: cast to restricted __be32
drivers/spi/spi-ti-qspi.c:376:42: sparse: sparse: cast to restricted __be32
drivers/spi/spi-ti-qspi.c:378:42: sparse: sparse: cast to restricted __be32
drivers/spi/spi-ti-qspi.c:378:42: sparse: sparse: cast to restricted __be32
drivers/spi/spi-ti-qspi.c:378:42: sparse: sparse: cast to restricted __be32
drivers/spi/spi-ti-qspi.c:378:42: sparse: sparse: cast to restricted __be32
drivers/spi/spi-ti-qspi.c:378:42: sparse: sparse: cast to restricted __be32
drivers/spi/spi-ti-qspi.c:378:42: sparse: sparse: cast to restricted __be32
drivers/spi/spi-ti-qspi.c:380:42: sparse: sparse: cast to restricted __be32
drivers/spi/spi-ti-qspi.c:380:42: sparse: sparse: cast to restricted __be32
drivers/spi/spi-ti-qspi.c:380:42: sparse: sparse: cast to restricted __be32
drivers/spi/spi-ti-qspi.c:380:42: sparse: sparse: cast to restricted __be32
drivers/spi/spi-ti-qspi.c:380:42: sparse: sparse: cast to restricted __be32
drivers/spi/spi-ti-qspi.c:380:42: sparse: sparse: cast to restricted __be32
drivers/spi/spi-ti-qspi.c:382:42: sparse: sparse: cast to restricted __be32
drivers/spi/spi-ti-qspi.c:382:42: sparse: sparse: cast to restricted __be32
drivers/spi/spi-ti-qspi.c:382:42: sparse: sparse: cast to restricted __be32
drivers/spi/spi-ti-qspi.c:382:42: sparse: sparse: cast to restricted __be32
drivers/spi/spi-ti-qspi.c:382:42: sparse: sparse: cast to restricted __be32
drivers/spi/spi-ti-qspi.c:382:42: sparse: sparse: cast to restricted __be32
--
>> drivers/soc/qcom/smd-rpm.c:177:47: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const volatile [noderef] __iomem *addr @@ got unsigned char const * @@
drivers/soc/qcom/smd-rpm.c:177:47: sparse: expected void const volatile [noderef] __iomem *addr
drivers/soc/qcom/smd-rpm.c:177:47: sparse: got unsigned char const *
--
>> drivers/misc/keba/cp500.c:962:34: sparse: sparse: Using plain integer as NULL pointer
--
>> drivers/tty/serial/pch_uart.c:1403:30: sparse: sparse: restricted upf_t degrades to integer
drivers/tty/serial/pch_uart.c:1407:32: sparse: sparse: invalid assignment: &=
drivers/tty/serial/pch_uart.c:1407:32: sparse: left side has type int
drivers/tty/serial/pch_uart.c:1407:32: sparse: right side has type restricted upf_t
drivers/tty/serial/pch_uart.c:1579:9: sparse: sparse: context imbalance in 'pch_console_write' - different lock contexts for basic block
--
>> drivers/video/fbdev/aty/atyfb_base.c:483:9: sparse: sparse: switch with no cases
vim +266 drivers/spi/spi-ti-qspi.c
57c2ecd9bf9719 Vignesh R 2015-10-13 241
1ff7760ff66b98 Ben Hutchings 2016-04-12 242 static int qspi_write_msg(struct ti_qspi *qspi, struct spi_transfer *t,
1ff7760ff66b98 Ben Hutchings 2016-04-12 243 int count)
505a14954e2d7f Sourav Poddar 2013-08-20 244 {
1ff7760ff66b98 Ben Hutchings 2016-04-12 245 int wlen, xfer_len;
505a14954e2d7f Sourav Poddar 2013-08-20 246 unsigned int cmd;
505a14954e2d7f Sourav Poddar 2013-08-20 247 const u8 *txbuf;
f682c4ffd25a19 Vignesh R 2015-08-20 248 u32 data;
505a14954e2d7f Sourav Poddar 2013-08-20 249
505a14954e2d7f Sourav Poddar 2013-08-20 250 txbuf = t->tx_buf;
505a14954e2d7f Sourav Poddar 2013-08-20 251 cmd = qspi->cmd | QSPI_WR_SNGL;
3ab546205411a2 Axel Lin 2014-01-12 252 wlen = t->bits_per_word >> 3; /* in bytes */
f682c4ffd25a19 Vignesh R 2015-08-20 253 xfer_len = wlen;
505a14954e2d7f Sourav Poddar 2013-08-20 254
505a14954e2d7f Sourav Poddar 2013-08-20 255 while (count) {
006110476478c6 Mugunthan V N 2015-02-18 256 if (qspi_is_busy(qspi))
006110476478c6 Mugunthan V N 2015-02-18 257 return -EBUSY;
006110476478c6 Mugunthan V N 2015-02-18 258
505a14954e2d7f Sourav Poddar 2013-08-20 259 switch (wlen) {
3ab546205411a2 Axel Lin 2014-01-12 260 case 1:
505a14954e2d7f Sourav Poddar 2013-08-20 261 dev_dbg(qspi->dev, "tx cmd %08x dc %08x data %02x\n",
505a14954e2d7f Sourav Poddar 2013-08-20 262 cmd, qspi->dc, *txbuf);
f682c4ffd25a19 Vignesh R 2015-08-20 263 if (count >= QSPI_WLEN_MAX_BYTES) {
f682c4ffd25a19 Vignesh R 2015-08-20 264 u32 *txp = (u32 *)txbuf;
f682c4ffd25a19 Vignesh R 2015-08-20 265
f682c4ffd25a19 Vignesh R 2015-08-20 @266 data = cpu_to_be32(*txp++);
f682c4ffd25a19 Vignesh R 2015-08-20 267 writel(data, qspi->base +
f682c4ffd25a19 Vignesh R 2015-08-20 268 QSPI_SPI_DATA_REG_3);
f682c4ffd25a19 Vignesh R 2015-08-20 269 data = cpu_to_be32(*txp++);
f682c4ffd25a19 Vignesh R 2015-08-20 270 writel(data, qspi->base +
f682c4ffd25a19 Vignesh R 2015-08-20 271 QSPI_SPI_DATA_REG_2);
f682c4ffd25a19 Vignesh R 2015-08-20 272 data = cpu_to_be32(*txp++);
f682c4ffd25a19 Vignesh R 2015-08-20 273 writel(data, qspi->base +
f682c4ffd25a19 Vignesh R 2015-08-20 274 QSPI_SPI_DATA_REG_1);
f682c4ffd25a19 Vignesh R 2015-08-20 275 data = cpu_to_be32(*txp++);
f682c4ffd25a19 Vignesh R 2015-08-20 276 writel(data, qspi->base +
f682c4ffd25a19 Vignesh R 2015-08-20 277 QSPI_SPI_DATA_REG);
f682c4ffd25a19 Vignesh R 2015-08-20 278 xfer_len = QSPI_WLEN_MAX_BYTES;
f682c4ffd25a19 Vignesh R 2015-08-20 279 cmd |= QSPI_WLEN(QSPI_WLEN_MAX_BITS);
f682c4ffd25a19 Vignesh R 2015-08-20 280 } else {
505a14954e2d7f Sourav Poddar 2013-08-20 281 writeb(*txbuf, qspi->base + QSPI_SPI_DATA_REG);
f682c4ffd25a19 Vignesh R 2015-08-20 282 cmd = qspi->cmd | QSPI_WR_SNGL;
f682c4ffd25a19 Vignesh R 2015-08-20 283 xfer_len = wlen;
f682c4ffd25a19 Vignesh R 2015-08-20 284 cmd |= QSPI_WLEN(wlen);
f682c4ffd25a19 Vignesh R 2015-08-20 285 }
505a14954e2d7f Sourav Poddar 2013-08-20 286 break;
3ab546205411a2 Axel Lin 2014-01-12 287 case 2:
505a14954e2d7f Sourav Poddar 2013-08-20 288 dev_dbg(qspi->dev, "tx cmd %08x dc %08x data %04x\n",
505a14954e2d7f Sourav Poddar 2013-08-20 289 cmd, qspi->dc, *txbuf);
505a14954e2d7f Sourav Poddar 2013-08-20 290 writew(*((u16 *)txbuf), qspi->base + QSPI_SPI_DATA_REG);
505a14954e2d7f Sourav Poddar 2013-08-20 291 break;
3ab546205411a2 Axel Lin 2014-01-12 292 case 4:
505a14954e2d7f Sourav Poddar 2013-08-20 293 dev_dbg(qspi->dev, "tx cmd %08x dc %08x data %08x\n",
505a14954e2d7f Sourav Poddar 2013-08-20 294 cmd, qspi->dc, *txbuf);
505a14954e2d7f Sourav Poddar 2013-08-20 295 writel(*((u32 *)txbuf), qspi->base + QSPI_SPI_DATA_REG);
3ab546205411a2 Axel Lin 2014-01-12 296 break;
3ab546205411a2 Axel Lin 2014-01-12 297 }
3ab546205411a2 Axel Lin 2014-01-12 298
505a14954e2d7f Sourav Poddar 2013-08-20 299 ti_qspi_write(qspi, cmd, QSPI_SPI_CMD_REG);
57c2ecd9bf9719 Vignesh R 2015-10-13 300 if (ti_qspi_poll_wc(qspi)) {
505a14954e2d7f Sourav Poddar 2013-08-20 301 dev_err(qspi->dev, "write timed out\n");
505a14954e2d7f Sourav Poddar 2013-08-20 302 return -ETIMEDOUT;
505a14954e2d7f Sourav Poddar 2013-08-20 303 }
f682c4ffd25a19 Vignesh R 2015-08-20 304 txbuf += xfer_len;
f682c4ffd25a19 Vignesh R 2015-08-20 305 count -= xfer_len;
505a14954e2d7f Sourav Poddar 2013-08-20 306 }
505a14954e2d7f Sourav Poddar 2013-08-20 307
505a14954e2d7f Sourav Poddar 2013-08-20 308 return 0;
505a14954e2d7f Sourav Poddar 2013-08-20 309 }
505a14954e2d7f Sourav Poddar 2013-08-20 310
:::::: The code at line 266 was first introduced by commit
:::::: f682c4ffd25a19594d21987c19a69fa123242eb7 spi: ti-qspi: use 128 bit transfer mode where possible
:::::: TO: Vignesh R <vigneshr@xxxxxx>
:::::: CC: Mark Brown <broonie@xxxxxxxxxx>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki