From 7b35dc71a30039dea921d88e338d3677bb6d87ad Mon Sep 17 00:00:00 2001 From: jhb Date: Tue, 7 Nov 2006 19:03:42 +0000 Subject: Fix some edge cases in detach (including attach failures): - Only call iwi_stop() if we got far enough along in iwi_attach() to alloc an ifnet. - Release the firmware after stopping the interface and detaching the ifnet. MFC after: 1 month Reviewed by: sam --- sys/dev/iwi/if_iwi.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sys/dev/iwi/if_iwi.c b/sys/dev/iwi/if_iwi.c index 2451281..c08afd6 100644 --- a/sys/dev/iwi/if_iwi.c +++ b/sys/dev/iwi/if_iwi.c @@ -488,13 +488,12 @@ iwi_detach(device_t dev) struct ieee80211com *ic = &sc->sc_ic; struct ifnet *ifp = ic->ic_ifp; - iwi_stop(sc); - iwi_put_firmware(sc); - if (ifp != NULL) { + iwi_stop(sc); bpfdetach(ifp); ieee80211_ifdetach(ic); } + iwi_put_firmware(sc); iwi_free_cmd_ring(sc, &sc->cmdq); iwi_free_tx_ring(sc, &sc->txq[0]); -- cgit v1.1