iwl3945: fix station stuff in RC algorithm
authorJohannes Berg <johannes@sipsolutions.net>
Fri, 10 Oct 2008 23:46:25 +0000 (01:46 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 31 Oct 2008 23:00:14 +0000 (19:00 -0400)
Probably bugs I added.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/iwlwifi/iwl-3945-rs.c

index bb91353c443e7d75bf1d93d7c2771eb702de5180..c25daec4f93d68790dec01aa3cb2a2abb058c68e 100644 (file)
@@ -826,13 +826,12 @@ void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
        rcu_read_lock();
 
        sta = ieee80211_find_sta(hw, priv->stations[sta_id].sta.sta.addr);
-       psta = (void *) sta->drv_priv;
-       if (!sta || !psta) {
-               IWL_DEBUG_RATE("leave - no private rate data!\n");
+       if (!sta) {
                rcu_read_unlock();
                return;
        }
 
+       psta = (void *) sta->drv_priv;
        rs_sta = psta->rs_sta;
 
        spin_lock_irqsave(&rs_sta->lock, flags);
@@ -856,7 +855,6 @@ void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
                break;
        }
 
-       rcu_read_unlock();
        spin_unlock_irqrestore(&rs_sta->lock, flags);
 
        rssi = priv->last_rx_rssi;
@@ -870,6 +868,7 @@ void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
        IWL_DEBUG_RATE("leave: rssi %d assign rate index: "
                       "%d (plcp 0x%x)\n", rssi, rs_sta->start_rate,
                       iwl3945_rates[rs_sta->start_rate].plcp);
+       rcu_read_unlock();
 }
 
 int iwl3945_rate_control_register(void)