[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202111211855.at1xbk20-lkp@intel.com>
Date: Mon, 22 Nov 2021 14:14:25 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: kbuild@...ts.01.org, Johannes Berg <johannes.berg@...el.com>
Cc: lkp@...el.com, kbuild-all@...ts.01.org,
linux-kernel@...r.kernel.org,
Luca Coelho <luciano.coelho@...el.com>
Subject: drivers/net/wireless/intel/iwlwifi/pcie/drv.c:1353 iwl_pci_probe()
warn: missing error code 'ret'
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 923dcc5eb0c111eccd51cc7ce1658537e3c38b25
commit: 2fd8aaaeb87441e2577e8e55373e9b3b221dc4b0 iwlwifi: pcie: try to grab NIC access early
config: mips-randconfig-m031-20211104 (attached as .config)
compiler: mips-linux-gcc (GCC) 11.2.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
New smatch warnings:
drivers/net/wireless/intel/iwlwifi/pcie/drv.c:1353 iwl_pci_probe() warn: missing error code 'ret'
vim +/ret +1353 drivers/net/wireless/intel/iwlwifi/pcie/drv.c
48d1a2110ad9cb drivers/net/wireless/iwlwifi/iwl-pci.c Emmanuel Grumbach 2011-05-24 1297 static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
48d1a2110ad9cb drivers/net/wireless/iwlwifi/iwl-pci.c Emmanuel Grumbach 2011-05-24 1298 {
48a5494d6a4cb5 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Johannes Berg 2021-03-30 1299 const struct iwl_cfg_trans_params *trans;
3fd0d3c170ad6b drivers/net/wireless/iwlwifi/pcie/drv.c Johannes Berg 2014-11-18 1300 const struct iwl_cfg *cfg_7265d __maybe_unused = NULL;
36a79223c4b998 drivers/net/wireless/iwlwifi/iwl-pci.c Emmanuel Grumbach 2012-02-27 1301 struct iwl_trans *iwl_trans;
c042f0c77f3df3 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Johannes Berg 2019-09-27 1302 struct iwl_trans_pcie *trans_pcie;
2a612a60ab440e drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2019-10-10 1303 int i, ret;
48a5494d6a4cb5 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Johannes Berg 2021-03-30 1304 const struct iwl_cfg *cfg;
48a5494d6a4cb5 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Johannes Berg 2021-03-30 1305
48a5494d6a4cb5 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Johannes Berg 2021-03-30 1306 trans = (void *)(ent->driver_data & ~TRANS_CFG_MARKER);
48a5494d6a4cb5 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Johannes Berg 2021-03-30 1307
b3bd6416fc77b5 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2019-10-10 1308 /*
b3bd6416fc77b5 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2019-10-10 1309 * This is needed for backwards compatibility with the old
b3bd6416fc77b5 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2019-10-10 1310 * tables, so we don't need to change all the config structs
b3bd6416fc77b5 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2019-10-10 1311 * at the same time. The cfg is used to compare with the old
b3bd6416fc77b5 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2019-10-10 1312 * full cfg structs.
b3bd6416fc77b5 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2019-10-10 1313 */
48a5494d6a4cb5 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Johannes Berg 2021-03-30 1314 cfg = (void *)(ent->driver_data & ~TRANS_CFG_MARKER);
a48709c5d076aa drivers/net/wireless/iwlwifi/iwl-pci.c Emmanuel Grumbach 2011-05-31 1315
b3bd6416fc77b5 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2019-10-10 1316 /* make sure trans is the first element in iwl_cfg */
b3bd6416fc77b5 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2019-10-10 1317 BUILD_BUG_ON(offsetof(struct iwl_cfg, trans));
a48709c5d076aa drivers/net/wireless/iwlwifi/iwl-pci.c Emmanuel Grumbach 2011-05-31 1318
b3bd6416fc77b5 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2019-10-10 1319 iwl_trans = iwl_trans_pcie_alloc(pdev, ent, trans);
6965a3540a4b45 drivers/net/wireless/iwlwifi/pcie/drv.c Luciano Coelho 2013-08-10 1320 if (IS_ERR(iwl_trans))
6965a3540a4b45 drivers/net/wireless/iwlwifi/pcie/drv.c Luciano Coelho 2013-08-10 1321 return PTR_ERR(iwl_trans);
b52e7ea109cfe4 drivers/net/wireless/iwlwifi/iwl-pci.c Emmanuel Grumbach 2012-02-02 1322
c042f0c77f3df3 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Johannes Berg 2019-09-27 1323 trans_pcie = IWL_TRANS_GET_PCIE_TRANS(iwl_trans);
c042f0c77f3df3 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Johannes Berg 2019-09-27 1324
2fd8aaaeb87441 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Johannes Berg 2021-10-17 1325 /*
2fd8aaaeb87441 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Johannes Berg 2021-10-17 1326 * Let's try to grab NIC access early here. Sometimes, NICs may
2fd8aaaeb87441 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Johannes Berg 2021-10-17 1327 * fail to initialize, and if that happens it's better if we see
2fd8aaaeb87441 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Johannes Berg 2021-10-17 1328 * issues early on (and can reprobe, per the logic inside), than
2fd8aaaeb87441 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Johannes Berg 2021-10-17 1329 * first trying to load the firmware etc. and potentially only
2fd8aaaeb87441 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Johannes Berg 2021-10-17 1330 * detecting any problems when the first interface is brought up.
2fd8aaaeb87441 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Johannes Berg 2021-10-17 1331 */
2fd8aaaeb87441 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Johannes Berg 2021-10-17 1332 ret = iwl_finish_nic_init(iwl_trans);
2fd8aaaeb87441 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Johannes Berg 2021-10-17 1333 if (ret)
2fd8aaaeb87441 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Johannes Berg 2021-10-17 1334 goto out_free_trans;
2fd8aaaeb87441 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Johannes Berg 2021-10-17 1335 if (iwl_trans_grab_nic_access(iwl_trans)) {
2fd8aaaeb87441 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Johannes Berg 2021-10-17 1336 /* all good */
2fd8aaaeb87441 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Johannes Berg 2021-10-17 1337 iwl_trans_release_nic_access(iwl_trans);
2fd8aaaeb87441 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Johannes Berg 2021-10-17 1338 } else {
2fd8aaaeb87441 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Johannes Berg 2021-10-17 1339 ret = -EIO;
2fd8aaaeb87441 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Johannes Berg 2021-10-17 1340 goto out_free_trans;
2fd8aaaeb87441 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Johannes Berg 2021-10-17 1341 }
2fd8aaaeb87441 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Johannes Berg 2021-10-17 1342
d6f2134a383168 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2020-03-09 1343 iwl_trans->hw_rf_id = iwl_read32(iwl_trans, CSR_HW_RF_ID);
d6f2134a383168 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2020-03-09 1344
1f171f4f1437f7 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Matti Gottlieb 2021-08-26 1345 /*
1f171f4f1437f7 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Matti Gottlieb 2021-08-26 1346 * The RF_ID is set to zero in blank OTP so read version to
1f171f4f1437f7 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Matti Gottlieb 2021-08-26 1347 * extract the RF_ID.
1f171f4f1437f7 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Matti Gottlieb 2021-08-26 1348 * This is relevant only for family 9000 and up.
1f171f4f1437f7 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Matti Gottlieb 2021-08-26 1349 */
1f171f4f1437f7 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Matti Gottlieb 2021-08-26 1350 if (iwl_trans->trans_cfg->rf_id &&
1f171f4f1437f7 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Matti Gottlieb 2021-08-26 1351 iwl_trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_9000 &&
1f171f4f1437f7 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Matti Gottlieb 2021-08-26 1352 !CSR_HW_RFID_TYPE(iwl_trans->hw_rf_id) && get_crf_id(iwl_trans))
1f171f4f1437f7 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Matti Gottlieb 2021-08-26 @1353 goto out_free_trans;
Should this be an error? If not the way to express this clearly and
silence the false positive is to set the error code explicitly:
if (iwl_trans->trans_cfg->rf_id &&
iwl_trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_9000 &&
!CSR_HW_RFID_TYPE(iwl_trans->hw_rf_id) && get_crf_id(iwl_trans)) {
ret = 0;
goto out_free_trans;
}
1f171f4f1437f7 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Matti Gottlieb 2021-08-26 1354
2a612a60ab440e drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2019-10-10 1355 for (i = 0; i < ARRAY_SIZE(iwl_dev_info_table); i++) {
2a612a60ab440e drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2019-10-10 1356 const struct iwl_dev_info *dev_info = &iwl_dev_info_table[i];
d6f2134a383168 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2020-03-09 1357 if ((dev_info->device == (u16)IWL_CFG_ANY ||
2a612a60ab440e drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2019-10-10 1358 dev_info->device == pdev->device) &&
d6f2134a383168 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2020-03-09 1359 (dev_info->subdevice == (u16)IWL_CFG_ANY ||
d6f2134a383168 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2020-03-09 1360 dev_info->subdevice == pdev->subsystem_device) &&
d6f2134a383168 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2020-03-09 1361 (dev_info->mac_type == (u16)IWL_CFG_ANY ||
d6f2134a383168 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2020-03-09 1362 dev_info->mac_type ==
d6f2134a383168 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2020-03-09 1363 CSR_HW_REV_TYPE(iwl_trans->hw_rev)) &&
be2f6886a34eb1 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2019-11-04 1364 (dev_info->mac_step == (u8)IWL_CFG_ANY ||
be2f6886a34eb1 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2019-11-04 1365 dev_info->mac_step ==
be2f6886a34eb1 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2019-11-04 1366 CSR_HW_REV_STEP(iwl_trans->hw_rev)) &&
d6f2134a383168 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2020-03-09 1367 (dev_info->rf_type == (u16)IWL_CFG_ANY ||
d6f2134a383168 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2020-03-09 1368 dev_info->rf_type ==
d6f2134a383168 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2020-03-09 1369 CSR_HW_RFID_TYPE(iwl_trans->hw_rf_id)) &&
b964bfd048d3ab drivers/net/wireless/intel/iwlwifi/pcie/drv.c Matti Gottlieb 2021-02-10 1370 (dev_info->cdb == IWL_CFG_NO_CDB ||
b964bfd048d3ab drivers/net/wireless/intel/iwlwifi/pcie/drv.c Matti Gottlieb 2021-02-10 1371 CSR_HW_RFID_IS_CDB(iwl_trans->hw_rf_id)) &&
f673a193d56ea0 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2020-03-09 1372 (dev_info->rf_id == (u8)IWL_CFG_ANY ||
f673a193d56ea0 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2020-03-09 1373 dev_info->rf_id ==
f673a193d56ea0 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2020-03-09 1374 IWL_SUBDEVICE_RF_ID(pdev->subsystem_device)) &&
d6f2134a383168 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2020-03-09 1375 (dev_info->no_160 == (u8)IWL_CFG_ANY ||
d6f2134a383168 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2020-03-09 1376 dev_info->no_160 ==
95939551e28c9b drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2020-03-09 1377 IWL_SUBDEVICE_NO_160(pdev->subsystem_device)) &&
95939551e28c9b drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2020-03-09 1378 (dev_info->cores == (u8)IWL_CFG_ANY ||
95939551e28c9b drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2020-03-09 1379 dev_info->cores ==
95939551e28c9b drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2020-03-09 1380 IWL_SUBDEVICE_CORES(pdev->subsystem_device))) {
2a612a60ab440e drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2019-10-10 1381 iwl_trans->cfg = dev_info->cfg;
0b295a1eb81f37 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2019-10-10 1382 iwl_trans->name = dev_info->name;
2a612a60ab440e drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2019-10-10 1383 }
7d34a7d7da97bc drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2019-07-12 1384 }
7d34a7d7da97bc drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2019-07-12 1385
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Powered by blists - more mailing lists