aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c
diff options
context:
space:
mode:
authorJakob Koschel <jakobkoschel@gmail.com>2022-12-05 10:35:42 +0200
committerGregory Greenman <gregory.greenman@intel.com>2022-12-07 17:36:08 +0200
commit6d7cb4a63db8716d23036323ff1a639cbade52ac (patch)
tree6870546b38e5b198cb67f76f14f48ae170eae024 /drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c
parentwifi: iwlwifi: dump: Update check for valid FW address (diff)
downloadlinux-6d7cb4a63db8716d23036323ff1a639cbade52ac.tar.xz
linux-6d7cb4a63db8716d23036323ff1a639cbade52ac.zip
wifi: iwlwifi: mvm: replace usage of found with dedicated list iterator variable
To move the list iterator variable into the list_for_each_entry_*() macro in the future it should be avoided to use the list iterator variable after the loop body. To *never* use the list iterator variable after the loop it was concluded to use a separate iterator variable instead of a found boolean [1]. This removes the need to use a found variable and simply checking if the variable was set, can determine if the break/goto was hit. While at it, stop using the unnecessary _safe() variant. [1] https://lore.kernel.org/all/CAHk-=wgRr_D8CB-D9Kg-c=EHreAsk5SqXPwr9Y7k9sA6cWXJ6w@mail.gmail.com/ Signed-off-by: Jakob Koschel <jakobkoschel@gmail.com> [change to not use _safe variant] Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Gregory Greenman <gregory.greenman@intel.com> Link: https://lore.kernel.org/r/20221205102808.e4882dc35543.I32b2b945ba234de72ee119fc20f5b8be02b6a3f2@changeid
Diffstat (limited to 'drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c')
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c b/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c
index 8c5b97fb1941..6eee3d0b2157 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c
@@ -1010,11 +1010,10 @@ static int iwl_mvm_ftm_range_resp_valid(struct iwl_mvm *mvm, u8 request_id,
static void iwl_mvm_ftm_rtt_smoothing(struct iwl_mvm *mvm,
struct cfg80211_pmsr_result *res)
{
- struct iwl_mvm_smooth_entry *resp;
+ struct iwl_mvm_smooth_entry *resp = NULL, *iter;
s64 rtt_avg, rtt = res->ftm.rtt_avg;
u32 undershoot, overshoot;
u8 alpha;
- bool found;
if (!IWL_MVM_FTM_INITIATOR_ENABLE_SMOOTH)
return;
@@ -1028,15 +1027,14 @@ static void iwl_mvm_ftm_rtt_smoothing(struct iwl_mvm *mvm,
return;
}
- found = false;
- list_for_each_entry(resp, &mvm->ftm_initiator.smooth.resp, list) {
- if (!memcmp(res->addr, resp->addr, ETH_ALEN)) {
- found = true;
+ list_for_each_entry(iter, &mvm->ftm_initiator.smooth.resp, list) {
+ if (!memcmp(res->addr, iter->addr, ETH_ALEN)) {
+ resp = iter;
break;
}
}
- if (!found) {
+ if (!resp) {
resp = kzalloc(sizeof(*resp), GFP_KERNEL);
if (!resp)
return;