summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/dev/ic/pgt.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/sys/dev/ic/pgt.c b/sys/dev/ic/pgt.c
index 2d84b6e59ac..ed98c03d8dc 100644
--- a/sys/dev/ic/pgt.c
+++ b/sys/dev/ic/pgt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pgt.c,v 1.36 2006/10/11 19:42:28 damien Exp $ */
+/* $OpenBSD: pgt.c,v 1.37 2006/10/13 22:35:49 mglocker Exp $ */
/*
* Copyright (c) 2006 Claudio Jeker <claudio@openbsd.org>
@@ -625,14 +625,14 @@ pgt_attach(void *xsc)
int
pgt_detach(struct pgt_softc *sc)
{
+ if (sc->sc_flags & SC_NEEDS_FIRMWARE || sc->sc_flags & SC_UNINITIALIZED)
+ /* device was not initialized correctly, so leave early */
+ goto out;
+
/* stop card */
pgt_stop(sc, SC_DYING);
pgt_reboot(sc);
- /* disable card if possible */
- if (sc->sc_disable != NULL)
- (*sc->sc_disable)(sc);
-
/*
* Disable shutdown and power hooks
*/
@@ -644,6 +644,11 @@ pgt_detach(struct pgt_softc *sc)
ieee80211_ifdetach(&sc->sc_ic.ic_if);
if_detach(&sc->sc_ic.ic_if);
+out:
+ /* disable card if possible */
+ if (sc->sc_disable != NULL)
+ (*sc->sc_disable)(sc);
+
pgt_dma_free(sc);
return (0);