wl1251: avoid redundant join commands
authorGrazvydas Ignotas <notasas@gmail.com>
Fri, 18 Apr 2014 00:47:00 +0000 (03:47 +0300)
committerGrazvydas Ignotas <notasas@gmail.com>
Sat, 19 Apr 2014 23:19:43 +0000 (02:19 +0300)
drivers/net/wireless/wl1251/main.c

index 68c9743..243d8d8 100644 (file)
@@ -1194,6 +1194,7 @@ static void wl1251_op_bss_info_changed(struct ieee80211_hw *hw,
 {
        struct wl1251 *wl = hw->priv;
        struct sk_buff *beacon, *skb;
+       bool do_join = false;
        bool enable;
        int ret;
 
@@ -1228,10 +1229,7 @@ static void wl1251_op_bss_info_changed(struct ieee80211_hw *hw,
                        if (ret < 0)
                                goto out_sleep;
 
-                       ret = wl1251_join(wl, wl->bss_type, wl->channel,
-                                         wl->beacon_int, wl->dtim_period);
-                       if (ret < 0)
-                               goto out_sleep;
+                       do_join = true;
                }
        }
 
@@ -1323,9 +1321,12 @@ static void wl1251_op_bss_info_changed(struct ieee80211_hw *hw,
                if (ret < 0)
                        goto out_sleep;
 
+               do_join = true;
+       }
+
+       if (do_join) {
                ret = wl1251_join(wl, wl->bss_type, wl->channel,
                                  wl->beacon_int, wl->dtim_period);
-
                if (ret < 0)
                        goto out_sleep;
        }