drivers/mtd/nand/raw/nand_legacy.c:42:17: sparse: sparse: cast from restricted __le16

From: kernel test robot

Date: Fri Dec 12 2025 - 00:22:26 EST


Hi Matthias,

FYI, the error/warning was bisected to this commit, please ignore it if it's irrelevant.

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: d358e5254674b70f34c847715ca509e46eb81e6f
commit: 2abb6e53b5b08987265946b258ca29762091930c gpio: tqmx86: use cleanup guards for spinlock
date: 12 months ago
config: x86_64-randconfig-121-20251212 (https://download.01.org/0day-ci/archive/20251212/202512121344.mk9pws1F-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/202512121344.mk9pws1F-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/202512121344.mk9pws1F-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
>> drivers/mtd/nand/raw/nand_legacy.c:42:17: sparse: sparse: cast from restricted __le16

vim +42 drivers/mtd/nand/raw/nand_legacy.c

3d4af7c195850c Boris Brezillon 2018-09-07 32
3d4af7c195850c Boris Brezillon 2018-09-07 33 /**
3d4af7c195850c Boris Brezillon 2018-09-07 34 * nand_read_byte16 - [DEFAULT] read one byte endianness aware from the chip
3d4af7c195850c Boris Brezillon 2018-09-07 35 * @chip: NAND chip object
3d4af7c195850c Boris Brezillon 2018-09-07 36 *
3d4af7c195850c Boris Brezillon 2018-09-07 37 * Default read function for 16bit buswidth with endianness conversion.
3d4af7c195850c Boris Brezillon 2018-09-07 38 *
3d4af7c195850c Boris Brezillon 2018-09-07 39 */
3d4af7c195850c Boris Brezillon 2018-09-07 40 static uint8_t nand_read_byte16(struct nand_chip *chip)
3d4af7c195850c Boris Brezillon 2018-09-07 41 {
3d4af7c195850c Boris Brezillon 2018-09-07 @42 return (uint8_t) cpu_to_le16(readw(chip->legacy.IO_ADDR_R));
3d4af7c195850c Boris Brezillon 2018-09-07 43 }
3d4af7c195850c Boris Brezillon 2018-09-07 44

:::::: The code at line 42 was first introduced by commit
:::::: 3d4af7c195850cfccaddc2cf03b010b95236b695 mtd: rawnand: Move legacy code to nand_legacy.c

:::::: TO: Boris Brezillon <boris.brezillon@xxxxxxxxxxx>
:::::: CC: Miquel Raynal <miquel.raynal@xxxxxxxxxxx>

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