ural(4): reduce copy-paste in ural_newstate().

Submitted by:	<s3erios@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D3656
This commit is contained in:
adrian 2015-10-03 05:55:16 +00:00
parent da2b024c31
commit d852547145

View File

@ -698,12 +698,9 @@ ural_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
ni = ieee80211_ref_node(vap->iv_bss);
if (vap->iv_opmode != IEEE80211_M_MONITOR) {
if (ic->ic_bsschan == IEEE80211_CHAN_ANYC) {
RAL_UNLOCK(sc);
IEEE80211_LOCK(ic);
ieee80211_free_node(ni);
return (-1);
}
if (ic->ic_bsschan == IEEE80211_CHAN_ANYC)
goto fail;
ural_update_slot(sc);
ural_set_txpreamble(sc);
ural_set_basicrates(sc, ic->ic_bsschan);
@ -717,19 +714,13 @@ ural_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
if (m == NULL) {
device_printf(sc->sc_dev,
"could not allocate beacon\n");
RAL_UNLOCK(sc);
IEEE80211_LOCK(ic);
ieee80211_free_node(ni);
return (-1);
goto fail;
}
ieee80211_ref_node(ni);
if (ural_tx_bcn(sc, m, ni) != 0) {
device_printf(sc->sc_dev,
"could not send beacon\n");
RAL_UNLOCK(sc);
IEEE80211_LOCK(ic);
ieee80211_free_node(ni);
return (-1);
goto fail;
}
}
@ -755,6 +746,12 @@ ural_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
RAL_UNLOCK(sc);
IEEE80211_LOCK(ic);
return (uvp->newstate(vap, nstate, arg));
fail:
RAL_UNLOCK(sc);
IEEE80211_LOCK(ic);
ieee80211_free_node(ni);
return (-1);
}