freebsd11_wlan: Don't try to ifdetach if we never ifattached.

The FreeBSD developers say that there are "lots of bugs around driver attach
failures," and this looks like one of them.

Hopefully helps with #12035.
This commit is contained in:
Augustin Cavalier 2018-07-10 17:57:01 -04:00
parent de6ea5f43f
commit e6f6c1b463

View File

@ -248,14 +248,14 @@ null_update_chw(struct ieee80211com *ic)
int
ic_printf(struct ieee80211com *ic, const char * fmt, ...)
{
{
va_list ap;
int retval;
retval = printf("%s: ", ic->ic_name);
va_start(ap, fmt);
retval += vprintf(fmt, ap);
va_end(ap);
va_end(ap);
return (retval);
}
@ -366,6 +366,12 @@ ieee80211_ifdetach(struct ieee80211com *ic)
LIST_REMOVE(ic, ic_next);
mtx_unlock(&ic_list_mtx);
#ifdef __HAIKU__
/* Have we even initialized this com? */
if (!ic->ic_tq)
return;
#endif
taskqueue_drain(taskqueue_thread, &ic->ic_restart_task);
/*
@ -644,7 +650,7 @@ ieee80211_vap_attach(struct ieee80211vap *vap, ifm_change_cb_t media_change,
return 1;
}
/*
/*
* Tear down vap state and reclaim the ifnet.
* The driver is assumed to have prepared for
* this; e.g. by turning off interrupts for the
@ -1365,7 +1371,7 @@ addmedia(struct ifmedia *media, int caps, int addsta, int mode, int mword)
#define ADD(_ic, _s, _o) \
ifmedia_add(media, \
IFM_MAKEWORD(IFM_IEEE80211, (_s), (_o), 0), 0, NULL)
static const u_int mopts[IEEE80211_MODE_MAX] = {
static const u_int mopts[IEEE80211_MODE_MAX] = {
[IEEE80211_MODE_AUTO] = IFM_AUTO,
[IEEE80211_MODE_11A] = IFM_IEEE80211_11A,
[IEEE80211_MODE_11B] = IFM_IEEE80211_11B,
@ -1963,13 +1969,13 @@ ieee80211_rate2media(struct ieee80211com *ic, int rate, enum ieee80211_phymode m
case IEEE80211_MODE_11NA:
case IEEE80211_MODE_TURBO_A:
case IEEE80211_MODE_STURBO_A:
return findmedia(rates, nitems(rates),
return findmedia(rates, nitems(rates),
rate | IFM_IEEE80211_11A);
case IEEE80211_MODE_11B:
return findmedia(rates, nitems(rates),
return findmedia(rates, nitems(rates),
rate | IFM_IEEE80211_11B);
case IEEE80211_MODE_FH:
return findmedia(rates, nitems(rates),
return findmedia(rates, nitems(rates),
rate | IFM_IEEE80211_FH);
case IEEE80211_MODE_AUTO:
/* NB: ic may be NULL for some drivers */