]> git.karo-electronics.de Git - linux-beck.git/commitdiff
mac80211: mesh_plink: collapse the two switch statements together
authorBob Copeland <me@bobcopeland.com>
Tue, 5 Nov 2013 19:16:55 +0000 (11:16 -0800)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 25 Nov 2013 19:50:05 +0000 (20:50 +0100)
The matches_local check can just be done when looking at the
individual action types.

Signed-off-by: Bob Copeland <bob@cozybit.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/mesh_plink.c

index 36b6cfffa6fbfd321de781f4c8fd494f72bf7878..8e23395146706205ee7a167f03b1448eb9dd5921 100644 (file)
@@ -821,33 +821,25 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata,
 
        /* Now we will figure out the appropriate event... */
        event = PLINK_UNDEFINED;
-       if (!matches_local) {
-               switch (ftype) {
-               case WLAN_SP_MESH_PEERING_OPEN:
-                       event = OPN_RJCT;
-                       break;
-               case WLAN_SP_MESH_PEERING_CONFIRM:
-                       event = CNF_RJCT;
-                       break;
-               default:
-                       break;
-               }
-       }
 
        if (!sta)
                event = OPN_ACPT;
-       else if (matches_local) {
+       else {
                switch (ftype) {
                case WLAN_SP_MESH_PEERING_OPEN:
-                       if (!mesh_plink_free_count(sdata) ||
-                           (sta->plid && sta->plid != plid))
+                       if (!matches_local)
+                               event = OPN_RJCT;
+                       else if (!mesh_plink_free_count(sdata) ||
+                                (sta->plid && sta->plid != plid))
                                event = OPN_IGNR;
                        else
                                event = OPN_ACPT;
                        break;
                case WLAN_SP_MESH_PEERING_CONFIRM:
-                       if (!mesh_plink_free_count(sdata) ||
-                           (sta->llid != llid || sta->plid != plid))
+                       if (!matches_local)
+                               event = CNF_RJCT;
+                       else if (!mesh_plink_free_count(sdata) ||
+                                (sta->llid != llid || sta->plid != plid))
                                event = CNF_IGNR;
                        else
                                event = CNF_ACPT;