summaryrefslogtreecommitdiff
path: root/sys/dev/pci/if_re_pci.c
diff options
context:
space:
mode:
authorBrad Smith <brad@cvs.openbsd.org>2008-10-12 00:54:50 +0000
committerBrad Smith <brad@cvs.openbsd.org>2008-10-12 00:54:50 +0000
commit65fda892d4d7c3534d525602e9a3f05872e6d468 (patch)
tree0cde74cf8a7817484e5f5a157533ee837cbcc798 /sys/dev/pci/if_re_pci.c
parent5e067e5fc4321f84090d4c1a2e2c7f7686c23b6a (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/pci/if_re_pci.c')
-rw-r--r--sys/dev/pci/if_re_pci.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/dev/pci/if_re_pci.c b/sys/dev/pci/if_re_pci.c
index db822c3285b..f4dfcfaa227 100644
--- a/sys/dev/pci/if_re_pci.c
+++ b/sys/dev/pci/if_re_pci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_re_pci.c,v 1.22 2008/10/05 22:32:11 brad Exp $ */
+/* $OpenBSD: if_re_pci.c,v 1.23 2008/10/12 00:54:49 brad Exp $ */
/*
* Copyright (c) 2005 Peter Valchev <pvalchev@openbsd.org>
@@ -195,5 +195,8 @@ re_pci_attach(struct device *parent, struct device *self, void *aux)
sc->rl_flags |= RL_FLAG_PCIE;
/* Call bus-independent attach routine */
- re_attach(sc, intrstr);
+ if (re_attach(sc, intrstr)) {
+ pci_intr_disestablish(pc, psc->sc_ih);
+ bus_space_unmap(sc->rl_btag, sc->rl_bhandle, iosize);
+ }
}