mac80211: station state transition error handling
In the future, when we start notifying drivers, state transitions could potentially fail. To make it easier to distinguish between programming bugs and driver failures: * rename sta_info_move_state() to sta_info_pre_move_state() which can only be called before the station is inserted (and check this with a new station flag). * rename sta_info_move_state_checked() to just plain sta_info_move_state(), as it will be the regular function that can fail for more than just one reason (bad transition or an error from the driver) This makes the programming model easier -- one of the functions can only be called before insertion and can't fail, the other can fail. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:

committed by
John W. Linville

parent
c037b8367c
commit
83d5cc0124
@@ -1587,10 +1587,19 @@ static bool ieee80211_assoc_success(struct ieee80211_work *wk,
|
||||
return false;
|
||||
}
|
||||
|
||||
sta_info_move_state(sta, IEEE80211_STA_AUTH);
|
||||
sta_info_move_state(sta, IEEE80211_STA_ASSOC);
|
||||
if (!(ifmgd->flags & IEEE80211_STA_CONTROL_PORT))
|
||||
sta_info_move_state(sta, IEEE80211_STA_AUTHORIZED);
|
||||
err = sta_info_move_state(sta, IEEE80211_STA_AUTH);
|
||||
if (!err)
|
||||
err = sta_info_move_state(sta, IEEE80211_STA_ASSOC);
|
||||
if (!err && !(ifmgd->flags & IEEE80211_STA_CONTROL_PORT))
|
||||
err = sta_info_move_state(sta, IEEE80211_STA_AUTHORIZED);
|
||||
if (err) {
|
||||
printk(KERN_DEBUG
|
||||
"%s: failed to move station %pM to desired state\n",
|
||||
sdata->name, sta->sta.addr);
|
||||
WARN_ON(__sta_info_destroy(sta));
|
||||
mutex_unlock(&sdata->local->sta_mtx);
|
||||
return false;
|
||||
}
|
||||
|
||||
rates = 0;
|
||||
basic_rates = 0;
|
||||
|
Reference in New Issue
Block a user