drivers/net/wireless/intel/iwlwifi/pcie/drv.c:1344:42: warning: implicit conversion from 'unsigned long' to 'int' changes value from 18446744073709551615 to -1

From: kernel test robot
Date: Sat Nov 06 2021 - 20:03:40 EST


Hi Johannes,

FYI, the error/warning still remains.

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: fe91c4725aeed35023ba4f7a1e1adfebb6878c23
commit: 3f7320428fa41a4c8be9c6f3d0cc06beeb0b3df8 iwlwifi: pcie: simplify iwl_pci_find_dev_info()
date: 10 days ago
config: arm64-buildonly-randconfig-r004-20211029 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 5db7568a6a1fcb408eb8988abdaff2a225a8eb72)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install arm64 cross compiling tool for clang build
# apt-get install binutils-aarch64-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3f7320428fa41a4c8be9c6f3d0cc06beeb0b3df8
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 3f7320428fa41a4c8be9c6f3d0cc06beeb0b3df8
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=arm64

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

>> drivers/net/wireless/intel/iwlwifi/pcie/drv.c:1344:42: warning: implicit conversion from 'unsigned long' to 'int' changes value from 18446744073709551615 to -1 [-Wconstant-conversion]
for (i = ARRAY_SIZE(iwl_dev_info_table) - 1; i >= 0; i--) {
~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
1 warning generated.


vim +1344 drivers/net/wireless/intel/iwlwifi/pcie/drv.c

1336
1337 static const struct iwl_dev_info *
1338 iwl_pci_find_dev_info(u16 device, u16 subsystem_device,
1339 u16 mac_type, u8 mac_step,
1340 u16 rf_type, u8 cdb, u8 rf_id, u8 no_160, u8 cores)
1341 {
1342 int i;
1343
> 1344 for (i = ARRAY_SIZE(iwl_dev_info_table) - 1; i >= 0; i--) {
1345 const struct iwl_dev_info *dev_info = &iwl_dev_info_table[i];
1346
1347 if (dev_info->device != (u16)IWL_CFG_ANY &&
1348 dev_info->device != device)
1349 continue;
1350
1351 if (dev_info->subdevice != (u16)IWL_CFG_ANY &&
1352 dev_info->subdevice != subsystem_device)
1353 continue;
1354
1355 if (dev_info->mac_type != (u16)IWL_CFG_ANY &&
1356 dev_info->mac_type != mac_type)
1357 continue;
1358
1359 if (dev_info->mac_step != (u8)IWL_CFG_ANY &&
1360 dev_info->mac_step != mac_step)
1361 continue;
1362
1363 if (dev_info->rf_type != (u16)IWL_CFG_ANY &&
1364 dev_info->rf_type != rf_type)
1365 continue;
1366
1367 if (dev_info->cdb != (u8)IWL_CFG_ANY &&
1368 dev_info->cdb != cdb)
1369 continue;
1370
1371 if (dev_info->rf_id != (u8)IWL_CFG_ANY &&
1372 dev_info->rf_id != rf_id)
1373 continue;
1374
1375 if (dev_info->no_160 != (u8)IWL_CFG_ANY &&
1376 dev_info->no_160 != no_160)
1377 continue;
1378
1379 if (dev_info->cores != (u8)IWL_CFG_ANY &&
1380 dev_info->cores != cores)
1381 continue;
1382
1383 return dev_info;
1384 }
1385
1386 return NULL;
1387 }
1388

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip