drivers/mmc/host/mxcmmc.c:557:21: sparse: sparse: incorrect type in assignment (different base types)

From: kernel test robot

Date: Thu Jul 23 2026 - 02:48:10 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 4539944e515183668109bdf4d0c3d7d228383d88
commit: 7cd8db0fb0b2bf309163d56fec585c0f9e0964d1 mmc: add COMPILE_TEST to multiple drivers
date: 10 months ago
config: m68k-randconfig-r112-20260723 (https://download.01.org/0day-ci/archive/20260723/202607231423.2GquEh7Y-lkp@xxxxxxxxx/config)
compiler: m68k-linux-gcc (GCC) 8.5.0
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260723/202607231423.2GquEh7Y-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
| Fixes: 7cd8db0fb0b2 ("mmc: add COMPILE_TEST to multiple drivers")
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202607231423.2GquEh7Y-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
drivers/mmc/host/mxcmmc.c:545:24: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] @@ got restricted __le32 [usertype] @@
drivers/mmc/host/mxcmmc.c:545:24: sparse: expected unsigned int [usertype]
drivers/mmc/host/mxcmmc.c:545:24: sparse: got restricted __le32 [usertype]
>> drivers/mmc/host/mxcmmc.c:557:21: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] tmp @@ got restricted __le32 [usertype] @@
drivers/mmc/host/mxcmmc.c:557:21: sparse: expected unsigned int [usertype] tmp
drivers/mmc/host/mxcmmc.c:557:21: sparse: got restricted __le32 [usertype]
>> drivers/mmc/host/mxcmmc.c:572:37: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected unsigned int [usertype] val @@ got restricted __le32 [usertype] @@
drivers/mmc/host/mxcmmc.c:572:37: sparse: expected unsigned int [usertype] val
drivers/mmc/host/mxcmmc.c:572:37: sparse: got restricted __le32 [usertype]
drivers/mmc/host/mxcmmc.c:585:37: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected unsigned int [usertype] val @@ got restricted __le32 [usertype] @@
drivers/mmc/host/mxcmmc.c:585:37: sparse: expected unsigned int [usertype] val
drivers/mmc/host/mxcmmc.c:585:37: sparse: got restricted __le32 [usertype]

vim +557 drivers/mmc/host/mxcmmc.c

d96be879ff46975 Sascha Hauer 2009-01-06 535
12658af54f2ed10 Linus Walleij 2024-01-27 536 static int mxcmci_pull(struct mxcmci_host *host, u32 *buf, int bytes)
d96be879ff46975 Sascha Hauer 2009-01-06 537 {
d96be879ff46975 Sascha Hauer 2009-01-06 538 unsigned int stat;
d96be879ff46975 Sascha Hauer 2009-01-06 539
d96be879ff46975 Sascha Hauer 2009-01-06 540 while (bytes > 3) {
d96be879ff46975 Sascha Hauer 2009-01-06 541 stat = mxcmci_poll_status(host,
d96be879ff46975 Sascha Hauer 2009-01-06 542 STATUS_BUF_READ_RDY | STATUS_READ_OP_DONE);
d96be879ff46975 Sascha Hauer 2009-01-06 543 if (stat)
d96be879ff46975 Sascha Hauer 2009-01-06 544 return stat;
c7ceab02543f8a0 Anatolij Gustschin 2013-04-08 545 *buf++ = cpu_to_le32(mxcmci_readl(host, MMC_REG_BUFFER_ACCESS));
d96be879ff46975 Sascha Hauer 2009-01-06 546 bytes -= 4;
d96be879ff46975 Sascha Hauer 2009-01-06 547 }
d96be879ff46975 Sascha Hauer 2009-01-06 548
d96be879ff46975 Sascha Hauer 2009-01-06 549 if (bytes) {
d96be879ff46975 Sascha Hauer 2009-01-06 550 u8 *b = (u8 *)buf;
d96be879ff46975 Sascha Hauer 2009-01-06 551 u32 tmp;
d96be879ff46975 Sascha Hauer 2009-01-06 552
d96be879ff46975 Sascha Hauer 2009-01-06 553 stat = mxcmci_poll_status(host,
d96be879ff46975 Sascha Hauer 2009-01-06 554 STATUS_BUF_READ_RDY | STATUS_READ_OP_DONE);
d96be879ff46975 Sascha Hauer 2009-01-06 555 if (stat)
d96be879ff46975 Sascha Hauer 2009-01-06 556 return stat;
c7ceab02543f8a0 Anatolij Gustschin 2013-04-08 @557 tmp = cpu_to_le32(mxcmci_readl(host, MMC_REG_BUFFER_ACCESS));
d96be879ff46975 Sascha Hauer 2009-01-06 558 memcpy(b, &tmp, bytes);
d96be879ff46975 Sascha Hauer 2009-01-06 559 }
d96be879ff46975 Sascha Hauer 2009-01-06 560
d96be879ff46975 Sascha Hauer 2009-01-06 561 return 0;
d96be879ff46975 Sascha Hauer 2009-01-06 562 }
d96be879ff46975 Sascha Hauer 2009-01-06 563
12658af54f2ed10 Linus Walleij 2024-01-27 564 static int mxcmci_push(struct mxcmci_host *host, u32 *buf, int bytes)
d96be879ff46975 Sascha Hauer 2009-01-06 565 {
d96be879ff46975 Sascha Hauer 2009-01-06 566 unsigned int stat;
d96be879ff46975 Sascha Hauer 2009-01-06 567
d96be879ff46975 Sascha Hauer 2009-01-06 568 while (bytes > 3) {
d96be879ff46975 Sascha Hauer 2009-01-06 569 stat = mxcmci_poll_status(host, STATUS_BUF_WRITE_RDY);
d96be879ff46975 Sascha Hauer 2009-01-06 570 if (stat)
d96be879ff46975 Sascha Hauer 2009-01-06 571 return stat;
c7ceab02543f8a0 Anatolij Gustschin 2013-04-08 @572 mxcmci_writel(host, cpu_to_le32(*buf++), MMC_REG_BUFFER_ACCESS);
d96be879ff46975 Sascha Hauer 2009-01-06 573 bytes -= 4;
d96be879ff46975 Sascha Hauer 2009-01-06 574 }
d96be879ff46975 Sascha Hauer 2009-01-06 575
d96be879ff46975 Sascha Hauer 2009-01-06 576 if (bytes) {
d96be879ff46975 Sascha Hauer 2009-01-06 577 u8 *b = (u8 *)buf;
d96be879ff46975 Sascha Hauer 2009-01-06 578 u32 tmp;
d96be879ff46975 Sascha Hauer 2009-01-06 579
d96be879ff46975 Sascha Hauer 2009-01-06 580 stat = mxcmci_poll_status(host, STATUS_BUF_WRITE_RDY);
d96be879ff46975 Sascha Hauer 2009-01-06 581 if (stat)
d96be879ff46975 Sascha Hauer 2009-01-06 582 return stat;
d96be879ff46975 Sascha Hauer 2009-01-06 583
d96be879ff46975 Sascha Hauer 2009-01-06 584 memcpy(&tmp, b, bytes);
c7ceab02543f8a0 Anatolij Gustschin 2013-04-08 585 mxcmci_writel(host, cpu_to_le32(tmp), MMC_REG_BUFFER_ACCESS);
d96be879ff46975 Sascha Hauer 2009-01-06 586 }
d96be879ff46975 Sascha Hauer 2009-01-06 587
6d91641613a6668 Fabio Estevam 2015-05-09 588 return mxcmci_poll_status(host, STATUS_BUF_WRITE_RDY);
d96be879ff46975 Sascha Hauer 2009-01-06 589 }
d96be879ff46975 Sascha Hauer 2009-01-06 590

:::::: The code at line 557 was first introduced by commit
:::::: c7ceab02543f8a03b4df3d4465b089c8117a5e09 mmc: mxcmmc: add mpc512x SDHC support

:::::: TO: Anatolij Gustschin <agust@xxxxxxx>
:::::: CC: Chris Ball <cjb@xxxxxxxxxx>

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