summaryrefslogtreecommitdiff
path: root/sys/dev/ic/atw.c
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2006-05-22 20:35:13 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2006-05-22 20:35:13 +0000
commit657c3498f0f1f12424b08b44ee1ab824bc20ba62 (patch)
tree6059bbe140fff90fbc52e205a78ecb62c6ecad0d /sys/dev/ic/atw.c
parent015937de55f300730d284d2cf72704203aad00eb (diff)
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/atw.c')
-rw-r--r--sys/dev/ic/atw.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/dev/ic/atw.c b/sys/dev/ic/atw.c
index 0ee9e7938f1..3a6ee80f30b 100644
--- a/sys/dev/ic/atw.c
+++ b/sys/dev/ic/atw.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: atw.c,v 1.45 2006/03/25 22:41:42 djm Exp $ */
+/* $OpenBSD: atw.c,v 1.46 2006/05/22 20:35:12 krw Exp $ */
/* $NetBSD: atw.c,v 1.69 2004/07/23 07:07:55 dyoung Exp $ */
/*-
@@ -2775,8 +2775,10 @@ atw_detach(struct atw_softc *sc)
sizeof(struct atw_control_data));
bus_dmamem_free(sc->sc_dmat, &sc->sc_cdseg, sc->sc_cdnseg);
- shutdownhook_disestablish(sc->sc_sdhook);
- powerhook_disestablish(sc->sc_powerhook);
+ if (sc->sc_sdhook != NULL)
+ shutdownhook_disestablish(sc->sc_sdhook);
+ if (sc->sc_powerhook != NULL)
+ powerhook_disestablish(sc->sc_powerhook);
if (sc->sc_srom)
free(sc->sc_srom, M_DEVBUF);