drivers/tty/ipwireless/hardware.c:431:25: sparse: sparse: incorrect type in initializer (different base types)

From: kernel test robot
Date: Sat Feb 11 2023 - 19:02:16 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 47e9aa14ce5abca70d6584a8d8213707d197c38e
commit: 30b5e6ef4a32ea4985b99200e06d6660a69f9246 m68k: atari: Make Atari ROM port I/O write macros return void
date: 9 months ago
config: m68k-randconfig-s033-20230212 (https://download.01.org/0day-ci/archive/20230212/202302120733.XDmW1EeP-lkp@xxxxxxxxx/config)
compiler: m68k-linux-gcc (GCC) 12.1.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-39-gce1a6720-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=30b5e6ef4a32ea4985b99200e06d6660a69f9246
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 30b5e6ef4a32ea4985b99200e06d6660a69f9246
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=m68k olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=m68k SHELL=/bin/bash drivers/tty/ipwireless/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Link: https://lore.kernel.org/oe-kbuild-all/202302120733.XDmW1EeP-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
drivers/tty/ipwireless/hardware.c:431:25: sparse: sparse: cast from restricted __le16
drivers/tty/ipwireless/hardware.c:431:25: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned short [usertype] val @@ got restricted __le16 [assigned] [usertype] raw_data @@
drivers/tty/ipwireless/hardware.c:431:25: sparse: expected unsigned short [usertype] val
drivers/tty/ipwireless/hardware.c:431:25: sparse: got restricted __le16 [assigned] [usertype] raw_data
drivers/tty/ipwireless/hardware.c:431:25: sparse: sparse: cast from restricted __le16
drivers/tty/ipwireless/hardware.c:431:25: sparse: sparse: cast from restricted __le16
>> drivers/tty/ipwireless/hardware.c:431:25: sparse: sparse: incorrect type in initializer (different base types) @@ expected unsigned short [unused] [usertype] __v @@ got restricted __le16 [assigned] [usertype] raw_data @@
drivers/tty/ipwireless/hardware.c:431:25: sparse: expected unsigned short [unused] [usertype] __v
drivers/tty/ipwireless/hardware.c:431:25: sparse: got restricted __le16 [assigned] [usertype] raw_data
>> drivers/tty/ipwireless/hardware.c:431:25: sparse: sparse: incorrect type in initializer (different base types) @@ expected unsigned short [unused] [usertype] __v @@ got restricted __le16 [assigned] [usertype] raw_data @@
drivers/tty/ipwireless/hardware.c:431:25: sparse: expected unsigned short [unused] [usertype] __v
drivers/tty/ipwireless/hardware.c:431:25: sparse: got restricted __le16 [assigned] [usertype] raw_data
drivers/tty/ipwireless/hardware.c:445:25: sparse: sparse: cast from restricted __le16
drivers/tty/ipwireless/hardware.c:445:25: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned short [usertype] val @@ got restricted __le16 [assigned] [usertype] raw_data @@
drivers/tty/ipwireless/hardware.c:445:25: sparse: expected unsigned short [usertype] val
drivers/tty/ipwireless/hardware.c:445:25: sparse: got restricted __le16 [assigned] [usertype] raw_data
drivers/tty/ipwireless/hardware.c:445:25: sparse: sparse: cast from restricted __le16
drivers/tty/ipwireless/hardware.c:445:25: sparse: sparse: cast from restricted __le16
drivers/tty/ipwireless/hardware.c:445:25: sparse: sparse: incorrect type in initializer (different base types) @@ expected unsigned short [unused] [usertype] __v @@ got restricted __le16 [assigned] [usertype] raw_data @@
drivers/tty/ipwireless/hardware.c:445:25: sparse: expected unsigned short [unused] [usertype] __v
drivers/tty/ipwireless/hardware.c:445:25: sparse: got restricted __le16 [assigned] [usertype] raw_data
drivers/tty/ipwireless/hardware.c:445:25: sparse: sparse: incorrect type in initializer (different base types) @@ expected unsigned short [unused] [usertype] __v @@ got restricted __le16 [assigned] [usertype] raw_data @@
drivers/tty/ipwireless/hardware.c:445:25: sparse: expected unsigned short [unused] [usertype] __v
drivers/tty/ipwireless/hardware.c:445:25: sparse: got restricted __le16 [assigned] [usertype] raw_data
drivers/tty/ipwireless/hardware.c:863:23: sparse: sparse: cast to restricted __le16
drivers/tty/ipwireless/hardware.c:863:23: sparse: sparse: cast to restricted __le16
drivers/tty/ipwireless/hardware.c:863:23: sparse: sparse: cast to restricted __le16
drivers/tty/ipwireless/hardware.c:863:23: sparse: sparse: cast to restricted __le16
drivers/tty/ipwireless/hardware.c:872:43: sparse: sparse: cast to restricted __le16
drivers/tty/ipwireless/hardware.c:872:43: sparse: sparse: cast to restricted __le16
drivers/tty/ipwireless/hardware.c:872:43: sparse: sparse: cast to restricted __le16
drivers/tty/ipwireless/hardware.c:872:43: sparse: sparse: cast to restricted __le16
drivers/tty/ipwireless/hardware.c:872:43: sparse: sparse: incorrect type in initializer (different base types) @@ expected restricted __le16 [usertype] raw_data @@ got int @@
drivers/tty/ipwireless/hardware.c:872:43: sparse: expected restricted __le16 [usertype] raw_data
drivers/tty/ipwireless/hardware.c:872:43: sparse: got int
drivers/tty/ipwireless/hardware.c:879:23: sparse: sparse: cast to restricted __le16
drivers/tty/ipwireless/hardware.c:879:23: sparse: sparse: cast to restricted __le16
drivers/tty/ipwireless/hardware.c:879:23: sparse: sparse: cast to restricted __le16
drivers/tty/ipwireless/hardware.c:879:23: sparse: sparse: cast to restricted __le16
drivers/tty/ipwireless/hardware.c:889:43: sparse: sparse: cast to restricted __le16
drivers/tty/ipwireless/hardware.c:889:43: sparse: sparse: cast to restricted __le16
drivers/tty/ipwireless/hardware.c:889:43: sparse: sparse: cast to restricted __le16
drivers/tty/ipwireless/hardware.c:889:43: sparse: sparse: cast to restricted __le16
drivers/tty/ipwireless/hardware.c:889:43: sparse: sparse: incorrect type in initializer (different base types) @@ expected restricted __le16 [usertype] raw_data @@ got int @@
drivers/tty/ipwireless/hardware.c:889:43: sparse: expected restricted __le16 [usertype] raw_data
drivers/tty/ipwireless/hardware.c:889:43: sparse: got int
drivers/tty/ipwireless/hardware.c:897:25: sparse: sparse: cast to restricted __le16
drivers/tty/ipwireless/hardware.c:897:25: sparse: sparse: cast to restricted __le16
drivers/tty/ipwireless/hardware.c:897:25: sparse: sparse: cast to restricted __le16
drivers/tty/ipwireless/hardware.c:897:25: sparse: sparse: cast to restricted __le16
drivers/tty/ipwireless/hardware.c:1051:24: sparse: sparse: cast to restricted __le16
drivers/tty/ipwireless/hardware.c:1051:24: sparse: sparse: cast to restricted __le16
drivers/tty/ipwireless/hardware.c:1051:24: sparse: sparse: cast to restricted __le16
drivers/tty/ipwireless/hardware.c:1051:24: sparse: sparse: cast to restricted __le16
drivers/tty/ipwireless/hardware.c:1062:16: sparse: sparse: cast to restricted __le16
drivers/tty/ipwireless/hardware.c:1062:16: sparse: sparse: cast to restricted __le16
drivers/tty/ipwireless/hardware.c:1062:16: sparse: sparse: cast to restricted __le16
drivers/tty/ipwireless/hardware.c:1062:16: sparse: sparse: cast to restricted __le16
drivers/tty/ipwireless/hardware.c:1607:24: sparse: sparse: cast to restricted __le16
drivers/tty/ipwireless/hardware.c:1607:24: sparse: sparse: cast to restricted __le16
drivers/tty/ipwireless/hardware.c:1607:24: sparse: sparse: cast to restricted __le16
drivers/tty/ipwireless/hardware.c:1607:24: sparse: sparse: cast to restricted __le16

vim +431 drivers/tty/ipwireless/hardware.c

d54c2752f6bb6c drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-07-28 403
93110f698fe92f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-07-28 404 static void do_send_fragment(struct ipw_hardware *hw, unsigned char *data,
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07 405 unsigned length)
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07 406 {
d4c0deb7009217 drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-07-28 407 unsigned i;
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07 408 unsigned long flags;
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07 409
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07 410 start_timing();
93110f698fe92f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-07-28 411 BUG_ON(length > hw->ll_mtu);
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07 412
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07 413 if (ipwireless_debug)
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07 414 dump_data_bytes("send", data, length);
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07 415
63c4dbd1023b9a drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-07-28 416 spin_lock_irqsave(&hw->lock, flags);
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07 417
eb4e545d4ac82d drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-06-06 418 hw->tx_ready = 0;
d54c2752f6bb6c drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-07-28 419 swap_packet_bitfield_to_le(data);
eb4e545d4ac82d drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-06-06 420
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07 421 if (hw->hw_version == HW_VERSION_1) {
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07 422 outw((unsigned short) length, hw->base_port + IODWR);
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07 423
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07 424 for (i = 0; i < length; i += 2) {
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07 425 unsigned short d = data[i];
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07 426 __le16 raw_data;
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07 427
d4c0deb7009217 drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-07-28 428 if (i + 1 < length)
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07 429 d |= data[i + 1] << 8;
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07 430 raw_data = cpu_to_le16(d);
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07 @431 outw(raw_data, hw->base_port + IODWR);
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07 432 }
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07 433
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07 434 outw(DCR_TXDONE, hw->base_port + IODCR);
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07 435 } else if (hw->hw_version == HW_VERSION_2) {
2e713165f892c8 drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-07-28 436 outw((unsigned short) length, hw->base_port);
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07 437
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07 438 for (i = 0; i < length; i += 2) {
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07 439 unsigned short d = data[i];
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07 440 __le16 raw_data;
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07 441
d4c0deb7009217 drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-07-28 442 if (i + 1 < length)
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07 443 d |= data[i + 1] << 8;
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07 444 raw_data = cpu_to_le16(d);
2e713165f892c8 drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-07-28 445 outw(raw_data, hw->base_port);
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07 446 }
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07 447 while ((i & 3) != 2) {
2e713165f892c8 drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-07-28 448 outw((unsigned short) 0xDEAD, hw->base_port);
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07 449 i += 2;
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07 450 }
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07 451 writew(MEMRX_RX, &hw->memory_info_regs->memreg_rx);
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07 452 }
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07 453
63c4dbd1023b9a drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-07-28 454 spin_unlock_irqrestore(&hw->lock, flags);
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07 455
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07 456 end_write_timing(length);
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07 457 }
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07 458

:::::: The code at line 431 was first introduced by commit
:::::: 099dc4fb62653f6019d78db55fba7a18ef02d65b ipwireless: driver for PC Card 3G/UMTS modem

:::::: TO: David Sterba <dsterba@xxxxxxx>
:::::: CC: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxxxxxxxx>

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