From a26ca0fb6645314d6b5dcd40c471343d96377660 Mon Sep 17 00:00:00 2001 From: Andrew Zaborowski Date: Sat, 30 Sep 2017 04:28:11 +0200 Subject: [PATCH] ap: Simplify ap_common_rates If we've checked that the STA has included our Basic Rate we've already found one common rate, no need for further checks. --- src/ap.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/ap.c b/src/ap.c index a6a87a77..a455fc65 100644 --- a/src/ap.c +++ b/src/ap.c @@ -795,19 +795,11 @@ static void ap_disassociate_sta(struct ap_state *ap, struct sta_state *sta) static bool ap_common_rates(struct l_uintset *ap_rates, struct l_uintset *sta_rates) { - uint32_t r, minr, maxr; - - minr = l_uintset_find_min(ap_rates); - maxr = l_uintset_find_max(ap_rates); + uint32_t minr = l_uintset_find_min(ap_rates); /* Our lowest rate is a Basic Rate so must be supported */ - if (!l_uintset_contains(sta_rates, minr)) - return false; - - for (r = minr + 1; r <= maxr; r++) - if (l_uintset_contains(ap_rates, r) && - l_uintset_contains(sta_rates, r)) - return true; + if (l_uintset_contains(sta_rates, minr)) + return true; return false; }