Avoid kernel panic and returns 802.11b.

Merge from branches/madwifi-dfs@3649


git-svn-id: http://madwifi-project.org/svn/madwifi/trunk@4078 0192ed92-7a03-0410-a25b-9323aeb14dbd
This commit is contained in:
benoit 2009-07-11 17:33:54 +00:00
parent 8c022a1869
commit d7126f8393

View File

@ -1578,11 +1578,19 @@ enum ieee80211_phymode
ieee80211_chan2mode(const struct ieee80211_channel *chan)
{
/*
* Callers should handle this case properly, rather than
* just relying that this function returns a sane value.
* XXX: Probably needs to be revised.
* Callers should handle this case properly, rather than just relying
* that this function returns a sane value. XXX: Probably needs to be
* revised. chan is undefined if channel is 0 for instance and kernel
* panic would happen when called by ieee80211_sta_join1() in IBSS
* mode.
*/
KASSERT(chan != IEEE80211_CHAN_ANYC, ("channel not setup"));
if (chan == NULL ||
chan == IEEE80211_CHAN_ANYC) {
printk(KERN_ERR "%s: BUG channel not setup: %p\n",
__func__, chan);
return IEEE80211_MODE_11B;
}
if (IEEE80211_IS_CHAN_108G(chan))
return IEEE80211_MODE_TURBO_G;