diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2006-05-22 20:35:13 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2006-05-22 20:35:13 +0000 |
commit | 657c3498f0f1f12424b08b44ee1ab824bc20ba62 (patch) | |
tree | 6059bbe140fff90fbc52e205a78ecb62c6ecad0d /sys/dev/ic | |
parent | 015937de55f300730d284d2cf72704203aad00eb (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')
-rw-r--r-- | sys/dev/ic/aic79xx_openbsd.c | 5 | ||||
-rw-r--r-- | sys/dev/ic/an.c | 5 | ||||
-rw-r--r-- | sys/dev/ic/ath.c | 8 | ||||
-rw-r--r-- | sys/dev/ic/atw.c | 8 | ||||
-rw-r--r-- | sys/dev/ic/dc.c | 8 | ||||
-rw-r--r-- | sys/dev/ic/fxp.c | 8 | ||||
-rw-r--r-- | sys/dev/ic/if_wi.c | 7 | ||||
-rw-r--r-- | sys/dev/ic/rtl81x9.c | 8 | ||||
-rw-r--r-- | sys/dev/ic/xl.c | 8 |
9 files changed, 40 insertions, 25 deletions
diff --git a/sys/dev/ic/aic79xx_openbsd.c b/sys/dev/ic/aic79xx_openbsd.c index c32948cd517..dae58bc9e3c 100644 --- a/sys/dev/ic/aic79xx_openbsd.c +++ b/sys/dev/ic/aic79xx_openbsd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aic79xx_openbsd.c,v 1.24 2006/03/04 14:20:37 krw Exp $ */ +/* $OpenBSD: aic79xx_openbsd.c,v 1.25 2006/05/22 20:35:12 krw Exp $ */ /* * Copyright (c) 2004 Milos Urbanek, Kenneth R. Westerback & Marco Peereboom @@ -639,7 +639,8 @@ ahd_detach(struct device *self, int flags) if (ahd->sc_child != NULL) rv = config_detach((void *)ahd->sc_child, flags); - shutdownhook_disestablish(ahd->shutdown_hook); + if (ahd->shutdown_hook != NULL) + shutdownhook_disestablish(ahd->shutdown_hook); ahd_free(ahd); diff --git a/sys/dev/ic/an.c b/sys/dev/ic/an.c index 0fea39c67fb..7f5f47b3963 100644 --- a/sys/dev/ic/an.c +++ b/sys/dev/ic/an.c @@ -1,4 +1,4 @@ -/* $OpenBSD: an.c,v 1.50 2006/04/05 14:28:20 kurt Exp $ */ +/* $OpenBSD: an.c,v 1.51 2006/05/22 20:35:12 krw Exp $ */ /* $NetBSD: an.c,v 1.34 2005/06/20 02:49:18 atatat Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -1675,7 +1675,8 @@ an_detach(struct an_softc *sc) ifmedia_delete_instance(&sc->sc_ic.ic_media, IFM_INST_ANY); ieee80211_ifdetach(ifp); if_detach(ifp); - shutdownhook_disestablish(sc->sc_sdhook); + if (sc->sc_sdhook != NULL) + shutdownhook_disestablish(sc->sc_sdhook); splx(s); return 0; } 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); 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); diff --git a/sys/dev/ic/dc.c b/sys/dev/ic/dc.c index a50371210fa..7c53a041857 100644 --- a/sys/dev/ic/dc.c +++ b/sys/dev/ic/dc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dc.c,v 1.94 2006/05/07 03:56:25 brad Exp $ */ +/* $OpenBSD: dc.c,v 1.95 2006/05/22 20:35:12 krw Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -1876,8 +1876,10 @@ dc_detach(sc) ether_ifdetach(ifp); if_detach(ifp); - shutdownhook_disestablish(sc->sc_dhook); - powerhook_disestablish(sc->sc_pwrhook); + if (sc->sc_dhook != NULL) + shutdownhook_disestablish(sc->sc_dhook); + if (sc->sc_pwrhook != NULL) + powerhook_disestablish(sc->sc_pwrhook); return (0); } diff --git a/sys/dev/ic/fxp.c b/sys/dev/ic/fxp.c index 0873810805b..024d67dd315 100644 --- a/sys/dev/ic/fxp.c +++ b/sys/dev/ic/fxp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fxp.c,v 1.77 2006/03/25 22:41:42 djm Exp $ */ +/* $OpenBSD: fxp.c,v 1.78 2006/05/22 20:35:12 krw Exp $ */ /* $NetBSD: if_fxp.c,v 1.2 1997/06/05 02:01:55 thorpej Exp $ */ /* @@ -578,8 +578,10 @@ fxp_detach(sc) ether_ifdetach(ifp); if_detach(ifp); - 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); return (0); } diff --git a/sys/dev/ic/if_wi.c b/sys/dev/ic/if_wi.c index 049ef897ab3..9f9f5b52bf2 100644 --- a/sys/dev/ic/if_wi.c +++ b/sys/dev/ic/if_wi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_wi.c,v 1.128 2006/04/10 00:58:52 deraadt Exp $ */ +/* $OpenBSD: if_wi.c,v 1.129 2006/05/22 20:35:12 krw Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -127,7 +127,7 @@ u_int32_t widebug = WIDEBUG; #if !defined(lint) && !defined(__OpenBSD__) static const char rcsid[] = - "$OpenBSD: if_wi.c,v 1.128 2006/04/10 00:58:52 deraadt Exp $"; + "$OpenBSD: if_wi.c,v 1.129 2006/05/22 20:35:12 krw Exp $"; #endif /* lint */ #ifdef foo @@ -2473,7 +2473,8 @@ wi_detach(struct wi_softc *sc) if (sc->wi_flags & WI_FLAGS_ATTACHED) { sc->wi_flags &= ~WI_FLAGS_ATTACHED; - shutdownhook_disestablish(sc->sc_sdhook); + if (sc->sc_sdhook != NULL) + shutdownhook_disestablish(sc->sc_sdhook); } } diff --git a/sys/dev/ic/rtl81x9.c b/sys/dev/ic/rtl81x9.c index 874073ea00d..58a014644c9 100644 --- a/sys/dev/ic/rtl81x9.c +++ b/sys/dev/ic/rtl81x9.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtl81x9.c,v 1.49 2006/04/20 20:31:12 miod Exp $ */ +/* $OpenBSD: rtl81x9.c,v 1.50 2006/05/22 20:35:12 krw Exp $ */ /* * Copyright (c) 1997, 1998 @@ -1360,8 +1360,10 @@ rl_detach(sc) ether_ifdetach(ifp); if_detach(ifp); - shutdownhook_disestablish(sc->sc_sdhook); - powerhook_disestablish(sc->sc_pwrhook); + if (sc->sc_sdhook != NULL) + shutdownhook_disestablish(sc->sc_sdhook); + if (sc->sc_pwrhook != NULL) + powerhook_disestablish(sc->sc_pwrhook); return (0); } diff --git a/sys/dev/ic/xl.c b/sys/dev/ic/xl.c index cf6223078dd..fa923644f2b 100644 --- a/sys/dev/ic/xl.c +++ b/sys/dev/ic/xl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xl.c,v 1.72 2006/03/25 22:41:43 djm Exp $ */ +/* $OpenBSD: xl.c,v 1.73 2006/05/22 20:35:12 krw Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -2863,8 +2863,10 @@ xl_detach(sc) ether_ifdetach(ifp); if_detach(ifp); - shutdownhook_disestablish(sc->sc_sdhook); - powerhook_disestablish(sc->sc_pwrhook); + if (sc->sc_sdhook != NULL) + shutdownhook_disestablish(sc->sc_sdhook); + if (sc->sc_pwrhook != NULL) + powerhook_disestablish(sc->sc_pwrhook); return (0); } |