diff options
author | Brad Smith <brad@cvs.openbsd.org> | 2008-10-12 00:54:50 +0000 |
---|---|---|
committer | Brad Smith <brad@cvs.openbsd.org> | 2008-10-12 00:54:50 +0000 |
commit | 65fda892d4d7c3534d525602e9a3f05872e6d468 (patch) | |
tree | 0cde74cf8a7817484e5f5a157533ee837cbcc798 /sys/dev/cardbus/if_re_cardbus.c | |
parent | 5e067e5fc4321f84090d4c1a2e2c7f7686c23b6a (diff) |
If re_attach() fails at any point make sure to disestablish various
resources setup by the bus front ends, especially the shutdown hook.
Found while testing some other changes with a CardBus adapter and
re_attach() was failing early before the interface pointer was
assigned. Then the system was rebooted, the shutdown hook was called
and *boom* in re_stop().
Diffstat (limited to 'sys/dev/cardbus/if_re_cardbus.c')
-rw-r--r-- | sys/dev/cardbus/if_re_cardbus.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/sys/dev/cardbus/if_re_cardbus.c b/sys/dev/cardbus/if_re_cardbus.c index 86ba66db2fd..7ab67814f24 100644 --- a/sys/dev/cardbus/if_re_cardbus.c +++ b/sys/dev/cardbus/if_re_cardbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_re_cardbus.c,v 1.13 2008/04/20 00:34:39 brad Exp $ */ +/* $OpenBSD: if_re_cardbus.c,v 1.14 2008/10/12 00:54:49 brad Exp $ */ /* * Copyright (c) 2005 Peter Valchev <pvalchev@openbsd.org> @@ -163,7 +163,15 @@ re_cardbus_attach(struct device *parent, struct device *self, void *aux) sc->sc_pwrhook = powerhook_establish(re_cardbus_powerhook, sc); /* Call bus-independent (common) attach routine */ - re_attach(sc, intrstr); + if (re_attach(sc, intrstr)) { + if (sc->sc_sdhook != NULL) + shutdownhook_disestablish(sc->sc_sdhook); + if (sc->sc_pwrhook != NULL) + powerhook_disestablish(sc->sc_pwrhook); + cardbus_intr_disestablish(ct->ct_cc, ct->ct_cf, csc->sc_ih); + Cardbus_mapreg_unmap(ct, csc->sc_bar_reg, sc->rl_btag, + sc->rl_bhandle, csc->sc_mapsize); + } } /* |