]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
wifi: iwlwifi: mvm: Use helper function IS_ERR_OR_NULL()
authorMiri Korenblit <miriam.rachel.korenblit@intel.com>
Sun, 29 Dec 2024 14:44:48 +0000 (16:44 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 13 Jan 2025 14:26:42 +0000 (15:26 +0100)
Use IS_ERR_OR_NULL() instead of open-coding it
to simplify the code.

Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20241229164246.d3423626d981.I3b4cc7f19d1bfecdb2e6a4eba8da1c7a41461115@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/intel/iwlwifi/mvm/tdls.c

index 65927ebbabb7c978f3195bf8cc18f9335af21b3c..36379b738de1bc9ddbb3b470ed6b8c025cbe3b29 100644 (file)
@@ -24,7 +24,7 @@ void iwl_mvm_teardown_tdls_peers(struct iwl_mvm *mvm)
        for (i = 0; i < mvm->fw->ucode_capa.num_stations; i++) {
                sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[i],
                                                lockdep_is_held(&mvm->mutex));
-               if (!sta || IS_ERR(sta) || !sta->tdls)
+               if (IS_ERR_OR_NULL(sta) || !sta->tdls)
                        continue;
 
                mvmsta = iwl_mvm_sta_from_mac80211(sta);
@@ -47,7 +47,7 @@ int iwl_mvm_tdls_sta_count(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
        for (i = 0; i < mvm->fw->ucode_capa.num_stations; i++) {
                sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[i],
                                                lockdep_is_held(&mvm->mutex));
-               if (!sta || IS_ERR(sta) || !sta->tdls)
+               if (IS_ERR_OR_NULL(sta) || !sta->tdls)
                        continue;
 
                if (vif) {
@@ -472,7 +472,7 @@ void iwl_mvm_tdls_ch_switch_work(struct work_struct *work)
                                mvm->fw_id_to_mac_id[mvm->tdls_cs.peer.sta_id],
                                lockdep_is_held(&mvm->mutex));
        /* the station may not be here, but if it is, it must be a TDLS peer */
-       if (!sta || IS_ERR(sta) || WARN_ON(!sta->tdls))
+       if (IS_ERR_OR_NULL(sta) || WARN_ON(!sta->tdls))
                return;
 
        mvmsta = iwl_mvm_sta_from_mac80211(sta);