drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c:711 iwl_mvm_mld_add_sta() warn: missing error code 'ret'
From: Dan Carpenter
Date: Mon Nov 27 2023 - 03:40:27 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: d2da77f431ac49b5763b88751a75f70daa46296c
commit: 3aa80d31869bc2ba86f709843f7dbe1514ea10bb wifi: iwlwifi: mvm: check for iwl_mvm_mld_update_sta() errors
config: powerpc-randconfig-r071-20231126 (https://download.01.org/0day-ci/archive/20231127/202311270524.6QM9aKuf-lkp@xxxxxxxxx/config)
compiler: powerpc-linux-gcc (GCC) 13.2.0
reproduce: (https://download.01.org/0day-ci/archive/20231127/202311270524.6QM9aKuf-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>
| Reported-by: Dan Carpenter <error27@xxxxxxxxx>
| Closes: https://lore.kernel.org/r/202311270524.6QM9aKuf-lkp@xxxxxxxxx/
smatch warnings:
drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c:711 iwl_mvm_mld_add_sta() warn: missing error code 'ret'
vim +/ret +711 drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c
57974a55d99546 Gregory Greenman 2023-03-28 670 int iwl_mvm_mld_add_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
57974a55d99546 Gregory Greenman 2023-03-28 671 struct ieee80211_sta *sta)
57974a55d99546 Gregory Greenman 2023-03-28 672 {
57974a55d99546 Gregory Greenman 2023-03-28 673 struct iwl_mvm_vif *mvm_vif = iwl_mvm_vif_from_mac80211(vif);
57974a55d99546 Gregory Greenman 2023-03-28 674 struct iwl_mvm_sta *mvm_sta = iwl_mvm_sta_from_mac80211(sta);
57974a55d99546 Gregory Greenman 2023-03-28 675 unsigned long link_sta_added_to_fw = 0;
57974a55d99546 Gregory Greenman 2023-03-28 676 struct ieee80211_link_sta *link_sta;
57974a55d99546 Gregory Greenman 2023-03-28 677 int ret = 0;
57974a55d99546 Gregory Greenman 2023-03-28 678 unsigned int link_id;
57974a55d99546 Gregory Greenman 2023-03-28 679
57974a55d99546 Gregory Greenman 2023-03-28 680 lockdep_assert_held(&mvm->mutex);
57974a55d99546 Gregory Greenman 2023-03-28 681
57974a55d99546 Gregory Greenman 2023-03-28 682 if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) {
57974a55d99546 Gregory Greenman 2023-03-28 683 ret = iwl_mvm_mld_alloc_sta_links(mvm, vif, sta);
87f7e2435cb7dd Miri Korenblit 2023-03-28 684 if (ret)
87f7e2435cb7dd Miri Korenblit 2023-03-28 685 return ret;
87f7e2435cb7dd Miri Korenblit 2023-03-28 686
57974a55d99546 Gregory Greenman 2023-03-28 687 spin_lock_init(&mvm_sta->lock);
57974a55d99546 Gregory Greenman 2023-03-28 688
57974a55d99546 Gregory Greenman 2023-03-28 689 ret = iwl_mvm_sta_init(mvm, vif, sta, IWL_MVM_INVALID_STA,
57974a55d99546 Gregory Greenman 2023-03-28 690 STATION_TYPE_PEER);
9e949dfdc5d169 Johannes Berg 2023-05-14 691 } else {
9e949dfdc5d169 Johannes Berg 2023-05-14 692 ret = iwl_mvm_alloc_sta_after_restart(mvm, vif, sta);
9e949dfdc5d169 Johannes Berg 2023-05-14 693 }
9e949dfdc5d169 Johannes Berg 2023-05-14 694
57974a55d99546 Gregory Greenman 2023-03-28 695 if (ret)
57974a55d99546 Gregory Greenman 2023-03-28 696 goto err;
57974a55d99546 Gregory Greenman 2023-03-28 697
57974a55d99546 Gregory Greenman 2023-03-28 698 /* at this stage sta link pointers are already allocated */
57974a55d99546 Gregory Greenman 2023-03-28 699 ret = iwl_mvm_mld_update_sta(mvm, vif, sta);
3aa80d31869bc2 Johannes Berg 2023-09-21 700 if (ret)
3aa80d31869bc2 Johannes Berg 2023-09-21 701 goto err;
57974a55d99546 Gregory Greenman 2023-03-28 702
57974a55d99546 Gregory Greenman 2023-03-28 703 for_each_sta_active_link(vif, sta, link_sta, link_id) {
57974a55d99546 Gregory Greenman 2023-03-28 704 struct ieee80211_bss_conf *link_conf =
0d504ca1f19b1a Johannes Berg 2023-03-29 705 link_conf_dereference_protected(vif, link_id);
57974a55d99546 Gregory Greenman 2023-03-28 706 struct iwl_mvm_link_sta *mvm_link_sta =
57974a55d99546 Gregory Greenman 2023-03-28 707 rcu_dereference_protected(mvm_sta->link[link_id],
57974a55d99546 Gregory Greenman 2023-03-28 708 lockdep_is_held(&mvm->mutex));
57974a55d99546 Gregory Greenman 2023-03-28 709
57974a55d99546 Gregory Greenman 2023-03-28 710 if (WARN_ON(!link_conf || !mvm_link_sta))
57974a55d99546 Gregory Greenman 2023-03-28 @711 goto err;
error code?
57974a55d99546 Gregory Greenman 2023-03-28 712
57974a55d99546 Gregory Greenman 2023-03-28 713 ret = iwl_mvm_mld_cfg_sta(mvm, sta, vif, link_sta, link_conf,
57974a55d99546 Gregory Greenman 2023-03-28 714 mvm_link_sta);
57974a55d99546 Gregory Greenman 2023-03-28 715 if (ret)
57974a55d99546 Gregory Greenman 2023-03-28 716 goto err;
57974a55d99546 Gregory Greenman 2023-03-28 717
57974a55d99546 Gregory Greenman 2023-03-28 718 link_sta_added_to_fw |= BIT(link_id);
57974a55d99546 Gregory Greenman 2023-03-28 719
57974a55d99546 Gregory Greenman 2023-03-28 720 if (vif->type == NL80211_IFTYPE_STATION)
57974a55d99546 Gregory Greenman 2023-03-28 721 iwl_mvm_mld_set_ap_sta_id(sta, mvm_vif->link[link_id],
57974a55d99546 Gregory Greenman 2023-03-28 722 mvm_link_sta);
57974a55d99546 Gregory Greenman 2023-03-28 723 }
87f7e2435cb7dd Miri Korenblit 2023-03-28 724
87f7e2435cb7dd Miri Korenblit 2023-03-28 725 return 0;
57974a55d99546 Gregory Greenman 2023-03-28 726
57974a55d99546 Gregory Greenman 2023-03-28 727 err:
57974a55d99546 Gregory Greenman 2023-03-28 728 /* remove all already allocated stations in FW */
57974a55d99546 Gregory Greenman 2023-03-28 729 for_each_set_bit(link_id, &link_sta_added_to_fw,
57974a55d99546 Gregory Greenman 2023-03-28 730 IEEE80211_MLD_MAX_NUM_LINKS) {
57974a55d99546 Gregory Greenman 2023-03-28 731 struct iwl_mvm_link_sta *mvm_link_sta =
57974a55d99546 Gregory Greenman 2023-03-28 732 rcu_dereference_protected(mvm_sta->link[link_id],
57974a55d99546 Gregory Greenman 2023-03-28 733 lockdep_is_held(&mvm->mutex));
57974a55d99546 Gregory Greenman 2023-03-28 734
57974a55d99546 Gregory Greenman 2023-03-28 735 iwl_mvm_mld_rm_sta_from_fw(mvm, mvm_link_sta->sta_id);
57974a55d99546 Gregory Greenman 2023-03-28 736 }
57974a55d99546 Gregory Greenman 2023-03-28 737
57974a55d99546 Gregory Greenman 2023-03-28 738 /* free all sta resources in the driver */
57974a55d99546 Gregory Greenman 2023-03-28 739 iwl_mvm_mld_sta_rm_all_sta_links(mvm, mvm_sta);
57974a55d99546 Gregory Greenman 2023-03-28 740 return ret;
87f7e2435cb7dd Miri Korenblit 2023-03-28 741 }
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki