Commit 11d62caf authored by Johannes Berg's avatar Johannes Berg

mac80211: simplify TDLS RA lookup

smatch pointed out that the second check of "tdls_auth" was
pointless since if it was true, we returned from the function
already. We can further simplify the code by moving the first
check (if it's a TDLS peer at all) into the outer if, to only
handle that inside. This simplifies the control flow here.
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 8d51dbb8
...@@ -2263,15 +2263,9 @@ static int ieee80211_lookup_ra_sta(struct ieee80211_sub_if_data *sdata, ...@@ -2263,15 +2263,9 @@ static int ieee80211_lookup_ra_sta(struct ieee80211_sub_if_data *sdata,
case NL80211_IFTYPE_STATION: case NL80211_IFTYPE_STATION:
if (sdata->wdev.wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS) { if (sdata->wdev.wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS) {
sta = sta_info_get(sdata, skb->data); sta = sta_info_get(sdata, skb->data);
if (sta) { if (sta && test_sta_flag(sta, WLAN_STA_TDLS_PEER)) {
bool tdls_peer, tdls_auth; if (test_sta_flag(sta,
WLAN_STA_TDLS_PEER_AUTH)) {
tdls_peer = test_sta_flag(sta,
WLAN_STA_TDLS_PEER);
tdls_auth = test_sta_flag(sta,
WLAN_STA_TDLS_PEER_AUTH);
if (tdls_peer && tdls_auth) {
*sta_out = sta; *sta_out = sta;
return 0; return 0;
} }
...@@ -2283,8 +2277,7 @@ static int ieee80211_lookup_ra_sta(struct ieee80211_sub_if_data *sdata, ...@@ -2283,8 +2277,7 @@ static int ieee80211_lookup_ra_sta(struct ieee80211_sub_if_data *sdata,
* after a TDLS sta is removed due to being * after a TDLS sta is removed due to being
* unreachable. * unreachable.
*/ */
if (tdls_peer && !tdls_auth && if (!ieee80211_is_tdls_setup(skb))
!ieee80211_is_tdls_setup(skb))
return -EINVAL; return -EINVAL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment