aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/wl12xx/main.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c
index f336e9cbd9e0..92f822043331 100644
--- a/drivers/net/wireless/wl12xx/main.c
+++ b/drivers/net/wireless/wl12xx/main.c
@@ -2624,7 +2624,7 @@ static int wl1271_op_get_survey(struct ieee80211_hw *hw, int idx,
2624 return 0; 2624 return 0;
2625} 2625}
2626 2626
2627static int wl1271_allocate_hlid(struct wl1271 *wl, 2627static int wl1271_allocate_sta(struct wl1271 *wl,
2628 struct ieee80211_sta *sta, 2628 struct ieee80211_sta *sta,
2629 u8 *hlid) 2629 u8 *hlid)
2630{ 2630{
@@ -2645,10 +2645,13 @@ static int wl1271_allocate_hlid(struct wl1271 *wl,
2645 return 0; 2645 return 0;
2646} 2646}
2647 2647
2648static void wl1271_free_hlid(struct wl1271 *wl, u8 hlid) 2648static void wl1271_free_sta(struct wl1271 *wl, u8 hlid)
2649{ 2649{
2650 int id = hlid - WL1271_AP_STA_HLID_START; 2650 int id = hlid - WL1271_AP_STA_HLID_START;
2651 2651
2652 if (WARN_ON(!test_bit(id, wl->ap_hlid_map)))
2653 return;
2654
2652 __clear_bit(id, wl->ap_hlid_map); 2655 __clear_bit(id, wl->ap_hlid_map);
2653 wl1271_tx_reset_link_queues(wl, hlid); 2656 wl1271_tx_reset_link_queues(wl, hlid);
2654} 2657}
@@ -2671,13 +2674,13 @@ static int wl1271_op_sta_add(struct ieee80211_hw *hw,
2671 2674
2672 wl1271_debug(DEBUG_MAC80211, "mac80211 add sta %d", (int)sta->aid); 2675 wl1271_debug(DEBUG_MAC80211, "mac80211 add sta %d", (int)sta->aid);
2673 2676
2674 ret = wl1271_allocate_hlid(wl, sta, &hlid); 2677 ret = wl1271_allocate_sta(wl, sta, &hlid);
2675 if (ret < 0) 2678 if (ret < 0)
2676 goto out; 2679 goto out;
2677 2680
2678 ret = wl1271_ps_elp_wakeup(wl, false); 2681 ret = wl1271_ps_elp_wakeup(wl, false);
2679 if (ret < 0) 2682 if (ret < 0)
2680 goto out; 2683 goto out_free_sta;
2681 2684
2682 ret = wl1271_cmd_add_sta(wl, sta, hlid); 2685 ret = wl1271_cmd_add_sta(wl, sta, hlid);
2683 if (ret < 0) 2686 if (ret < 0)
@@ -2686,6 +2689,10 @@ static int wl1271_op_sta_add(struct ieee80211_hw *hw,
2686out_sleep: 2689out_sleep:
2687 wl1271_ps_elp_sleep(wl); 2690 wl1271_ps_elp_sleep(wl);
2688 2691
2692out_free_sta:
2693 if (ret < 0)
2694 wl1271_free_sta(wl, hlid);
2695
2689out: 2696out:
2690 mutex_unlock(&wl->mutex); 2697 mutex_unlock(&wl->mutex);
2691 return ret; 2698 return ret;
@@ -2722,7 +2729,7 @@ static int wl1271_op_sta_remove(struct ieee80211_hw *hw,
2722 if (ret < 0) 2729 if (ret < 0)
2723 goto out_sleep; 2730 goto out_sleep;
2724 2731
2725 wl1271_free_hlid(wl, wl_sta->hlid); 2732 wl1271_free_sta(wl, wl_sta->hlid);
2726 2733
2727out_sleep: 2734out_sleep:
2728 wl1271_ps_elp_sleep(wl); 2735 wl1271_ps_elp_sleep(wl);