mac80211: fix mesh_path and sta_info get_by_idx functions
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / net / mac80211 / sta_info.c
index e27f896dae537f70e6e65ca8c1b8dd98e0affa5a..3b84c16cf0544cb13c1f72b884d570b866ee5456 100644 (file)
@@ -115,12 +115,13 @@ struct sta_info *sta_info_get_by_idx(struct ieee80211_local *local, int idx,
        int i = 0;
 
        list_for_each_entry_rcu(sta, &local->sta_list, list) {
+               if (dev && dev != sta->sdata->dev)
+                       continue;
                if (i < idx) {
                        ++i;
                        continue;
-               } else if (!dev || dev == sta->sdata->dev) {
-                       return sta;
                }
+               return sta;
        }
 
        return NULL;