summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2009-05-30 18:46:07 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2009-05-30 18:46:07 +0000
commite219c8e4575a84b0cdfbb3c5732b11e8ede670dc (patch)
tree6771c41651fc38867f2492774a435dc591f118a4
parent4ce1a40a31027a74e63cbbe85a9eb60b87a74b56 (diff)
Check the extents exist before trying to do things
with them in ppb_hotplug_remove(). ok kettenis@
-rw-r--r--sys/dev/pci/ppb.c42
1 files changed, 24 insertions, 18 deletions
diff --git a/sys/dev/pci/ppb.c b/sys/dev/pci/ppb.c
index 6b9b39c2606..1f16800d02f 100644
--- a/sys/dev/pci/ppb.c
+++ b/sys/dev/pci/ppb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ppb.c,v 1.33 2009/05/15 21:51:58 kettenis Exp $ */
+/* $OpenBSD: ppb.c,v 1.34 2009/05/30 18:46:06 jsg Exp $ */
/* $NetBSD: ppb.c,v 1.16 1997/06/06 23:48:05 thorpej Exp $ */
/*
@@ -482,23 +482,29 @@ ppb_hotplug_remove(void *arg1, void *arg2)
* XXX Allocate the entire window with EX_CONFLICTOK
* such that we can easily free it.
*/
- extent_alloc_region(sc->sc_ioex, sc->sc_iobase,
- sc->sc_iolimit - sc->sc_iobase + 1,
- EX_NOWAIT | EX_CONFLICTOK);
- extent_free(sc->sc_ioex, sc->sc_iobase,
- sc->sc_iolimit - sc->sc_iobase + 1, EX_NOWAIT);
-
- extent_alloc_region(sc->sc_memex, sc->sc_membase,
- sc->sc_memlimit - sc->sc_membase + 1,
- EX_NOWAIT | EX_CONFLICTOK);
- extent_free(sc->sc_memex, sc->sc_membase,
- sc->sc_memlimit - sc->sc_membase + 1, EX_NOWAIT);
-
- extent_alloc_region(sc->sc_pmemex, sc->sc_pmembase,
- sc->sc_pmemlimit - sc->sc_pmembase + 1,
- EX_NOWAIT | EX_CONFLICTOK);
- extent_free(sc->sc_pmemex, sc->sc_pmembase,
- sc->sc_pmemlimit - sc->sc_pmembase + 1, EX_NOWAIT);
+ if (sc->sc_ioex != NULL) {
+ extent_alloc_region(sc->sc_ioex, sc->sc_iobase,
+ sc->sc_iolimit - sc->sc_iobase + 1,
+ EX_NOWAIT | EX_CONFLICTOK);
+ extent_free(sc->sc_ioex, sc->sc_iobase,
+ sc->sc_iolimit - sc->sc_iobase + 1, EX_NOWAIT);
+ }
+
+ if (sc->sc_memex != NULL) {
+ extent_alloc_region(sc->sc_memex, sc->sc_membase,
+ sc->sc_memlimit - sc->sc_membase + 1,
+ EX_NOWAIT | EX_CONFLICTOK);
+ extent_free(sc->sc_memex, sc->sc_membase,
+ sc->sc_memlimit - sc->sc_membase + 1, EX_NOWAIT);
+ }
+
+ if (sc->sc_pmemex != NULL) {
+ extent_alloc_region(sc->sc_pmemex, sc->sc_pmembase,
+ sc->sc_pmemlimit - sc->sc_pmembase + 1,
+ EX_NOWAIT | EX_CONFLICTOK);
+ extent_free(sc->sc_pmemex, sc->sc_pmembase,
+ sc->sc_pmemlimit - sc->sc_pmembase + 1, EX_NOWAIT);
+ }
}
}