summaryrefslogtreecommitdiffstats
path: root/sys/dev/ic/ath.c
diff options
context:
space:
mode:
authorkrw <krw@openbsd.org>2006-05-22 20:35:12 +0000
committerkrw <krw@openbsd.org>2006-05-22 20:35:12 +0000
commitd8ed46e47baf955136da5c04fb1401169e5ff07e (patch)
treef730da70eb7a085fac3d484c7fee375a0eb6b2ac /sys/dev/ic/ath.c
parentAdd support for raid 50 and 10 in bio. (diff)
downloadwireguard-openbsd-d8ed46e47baf955136da5c04fb1401169e5ff07e.tar.xz
wireguard-openbsd-d8ed46e47baf955136da5c04fb1401169e5ff07e.zip
Attach routines can fail before calling *hook_establish(), and they
often rely on the detach routine for cleanup. So be consistant and careful by checking for a NULL hook before calling *hook_disestablish in detach routines. ok mickey@ brad@ dlg@
Diffstat (limited to 'sys/dev/ic/ath.c')
-rw-r--r--sys/dev/ic/ath.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/dev/ic/ath.c b/sys/dev/ic/ath.c
index bb1f4090432..16f5587cbf6 100644
--- a/sys/dev/ic/ath.c
+++ b/sys/dev/ic/ath.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ath.c,v 1.49 2006/05/08 18:32:11 pedro Exp $ */
+/* $OpenBSD: ath.c,v 1.50 2006/05/22 20:35:12 krw Exp $ */
/* $NetBSD: ath.c,v 1.37 2004/08/18 21:59:39 dyoung Exp $ */
/*-
@@ -459,8 +459,10 @@ ath_detach(struct ath_softc *sc, int flags)
if_detach(ifp);
splx(s);
- powerhook_disestablish(sc->sc_powerhook);
- shutdownhook_disestablish(sc->sc_sdhook);
+ if (sc->sc_powerhook != NULL)
+ powerhook_disestablish(sc->sc_powerhook);
+ if (sc->sc_sdhook != NULL)
+ shutdownhook_disestablish(sc->sc_sdhook);
#ifdef __FreeBSD__
ATH_TXBUF_LOCK_DESTROY(sc);
ATH_TXQ_LOCK_DESTROY(sc);