drivers/ata/pata_ep93xx.c:494:33: sparse: sparse: incorrect type in assignment (different base types)

From: kernel test robot

Date: Thu Jul 23 2026 - 03:22:00 EST


Hi Rosen,

First bad commit (maybe != root cause):

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 4539944e515183668109bdf4d0c3d7d228383d88
commit: 590da526959499e58671f65655825d8a1973ff27 ata: pata_ep93xx: add COMPILE_TEST support
date: 7 weeks ago
config: microblaze-randconfig-r121-20260723 (https://download.01.org/0day-ci/archive/20260723/202607231521.gvhnJpOG-lkp@xxxxxxxxx/config)
compiler: microblaze-linux-gcc (GCC) 16.1.0
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260723/202607231521.gvhnJpOG-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: 590da5269594 ("ata: pata_ep93xx: add COMPILE_TEST support")
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202607231521.gvhnJpOG-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
>> drivers/ata/pata_ep93xx.c:494:33: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned short [usertype] @@ got restricted __le16 [usertype] @@
drivers/ata/pata_ep93xx.c:494:33: sparse: expected unsigned short [usertype]
drivers/ata/pata_ep93xx.c:494:33: sparse: got restricted __le16 [usertype]
>> drivers/ata/pata_ep93xx.c:498:58: sparse: sparse: cast to restricted __le16
>> drivers/ata/pata_ep93xx.c:508:30: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned char @@ got restricted __le16 [usertype] @@
drivers/ata/pata_ep93xx.c:508:30: sparse: expected unsigned char
drivers/ata/pata_ep93xx.c:508:30: sparse: got restricted __le16 [usertype]
drivers/ata/pata_ep93xx.c:514:58: sparse: sparse: cast to restricted __le16

vim +494 drivers/ata/pata_ep93xx.c

2fff27512600f9 Rafal Prylowski 2012-04-12 480
2fff27512600f9 Rafal Prylowski 2012-04-12 481 /* Note: original code is ata_sff_data_xfer */
989e0aac1a801e Bartlomiej Zolnierkiewicz 2016-12-30 482 static unsigned int ep93xx_pata_data_xfer(struct ata_queued_cmd *qc,
2fff27512600f9 Rafal Prylowski 2012-04-12 483 unsigned char *buf,
2fff27512600f9 Rafal Prylowski 2012-04-12 484 unsigned int buflen, int rw)
2fff27512600f9 Rafal Prylowski 2012-04-12 485 {
989e0aac1a801e Bartlomiej Zolnierkiewicz 2016-12-30 486 struct ata_port *ap = qc->dev->link->ap;
2fff27512600f9 Rafal Prylowski 2012-04-12 487 struct ep93xx_pata_data *drv_data = ap->host->private_data;
2fff27512600f9 Rafal Prylowski 2012-04-12 488 u16 *data = (u16 *)buf;
2fff27512600f9 Rafal Prylowski 2012-04-12 489 unsigned int words = buflen >> 1;
2fff27512600f9 Rafal Prylowski 2012-04-12 490
2fff27512600f9 Rafal Prylowski 2012-04-12 491 /* Transfer multiple of 2 bytes */
2fff27512600f9 Rafal Prylowski 2012-04-12 492 while (words--)
2fff27512600f9 Rafal Prylowski 2012-04-12 493 if (rw == READ)
2fff27512600f9 Rafal Prylowski 2012-04-12 @494 *data++ = cpu_to_le16(
2fff27512600f9 Rafal Prylowski 2012-04-12 495 ep93xx_pata_read_data(
2fff27512600f9 Rafal Prylowski 2012-04-12 496 drv_data, IDECTRL_ADDR_DATA));
2fff27512600f9 Rafal Prylowski 2012-04-12 497 else
2fff27512600f9 Rafal Prylowski 2012-04-12 @498 ep93xx_pata_write_data(drv_data, le16_to_cpu(*data++),
2fff27512600f9 Rafal Prylowski 2012-04-12 499 IDECTRL_ADDR_DATA);
2fff27512600f9 Rafal Prylowski 2012-04-12 500
2fff27512600f9 Rafal Prylowski 2012-04-12 501 /* Transfer trailing 1 byte, if any. */
2fff27512600f9 Rafal Prylowski 2012-04-12 502 if (unlikely(buflen & 0x01)) {
2fff27512600f9 Rafal Prylowski 2012-04-12 503 unsigned char pad[2] = { };
2fff27512600f9 Rafal Prylowski 2012-04-12 504
2fff27512600f9 Rafal Prylowski 2012-04-12 505 buf += buflen - 1;
2fff27512600f9 Rafal Prylowski 2012-04-12 506
2fff27512600f9 Rafal Prylowski 2012-04-12 507 if (rw == READ) {
2fff27512600f9 Rafal Prylowski 2012-04-12 @508 *pad = cpu_to_le16(
2fff27512600f9 Rafal Prylowski 2012-04-12 509 ep93xx_pata_read_data(
2fff27512600f9 Rafal Prylowski 2012-04-12 510 drv_data, IDECTRL_ADDR_DATA));
2fff27512600f9 Rafal Prylowski 2012-04-12 511 *buf = pad[0];
2fff27512600f9 Rafal Prylowski 2012-04-12 512 } else {
2fff27512600f9 Rafal Prylowski 2012-04-12 513 pad[0] = *buf;
2fff27512600f9 Rafal Prylowski 2012-04-12 514 ep93xx_pata_write_data(drv_data, le16_to_cpu(*pad),
2fff27512600f9 Rafal Prylowski 2012-04-12 515 IDECTRL_ADDR_DATA);
2fff27512600f9 Rafal Prylowski 2012-04-12 516 }
2fff27512600f9 Rafal Prylowski 2012-04-12 517 words++;
2fff27512600f9 Rafal Prylowski 2012-04-12 518 }
2fff27512600f9 Rafal Prylowski 2012-04-12 519
2fff27512600f9 Rafal Prylowski 2012-04-12 520 return words << 1;
2fff27512600f9 Rafal Prylowski 2012-04-12 521 }
2fff27512600f9 Rafal Prylowski 2012-04-12 522

:::::: The code at line 494 was first introduced by commit
:::::: 2fff27512600f9ad91335577e485a8552edb0abf PATA host controller driver for ep93xx

:::::: TO: Rafal Prylowski <prylowski@xxxxxxxxxxx>
:::::: CC: Jeff Garzik <jgarzik@xxxxxxxxxx>

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