]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
wifi: mac80211: clean up return in ieee802_11_find_bssid_profile()
authorJohannes Berg <johannes.berg@intel.com>
Fri, 29 May 2026 08:24:56 +0000 (10:24 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 3 Jun 2026 12:11:56 +0000 (14:11 +0200)
There's no need to define 'profile_len' at the outer scope
and initialize it, move it where needed and just return 0
if nothing can be found.

Link: https://patch.msgid.link/20260529102644.46f25609ddef.I9e651a0018e66953f4fb508f784188e00351c07f@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/parse.c

index c44e81a2f80d567f1ade1abb101e39611f31acd7..1ed1fc25da1271bdbbbbc81e9fea01b899b7ce39 100644 (file)
@@ -828,10 +828,9 @@ static size_t ieee802_11_find_bssid_profile(const u8 *start, size_t len,
                                            u8 *nontransmitted_profile)
 {
        const struct element *elem, *sub;
-       size_t profile_len = 0;
 
        if (!bss || !bss->transmitted_bss)
-               return profile_len;
+               return 0;
 
        for_each_element_id(elem, WLAN_EID_MULTIPLE_BSSID, start, len) {
                if (elem->datalen < 2)
@@ -841,6 +840,7 @@ static size_t ieee802_11_find_bssid_profile(const u8 *start, size_t len,
 
                for_each_element(sub, elem->data + 1, elem->datalen - 1) {
                        u8 new_bssid[ETH_ALEN];
+                       size_t profile_len;
                        const u8 *index;
 
                        if (sub->id != 0 || sub->datalen < 4) {