summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2006-05-22 15:58:01 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2006-05-22 15:58:01 +0000
commit6ed99fd1912cfe624091790de26540a1cc873c4f (patch)
tree917f19d1a4c4d5569762d0ef2a0b3f571b91e07d
parenta57a45c5523a8a76125df5559386e2492f279bae (diff)
Don't call powerhook_disestablish if there is no powerhook to disestablish.
This is possible if ohci_init fails in attach. Similar to krw@'s fix in ohci.c 1.67 for PR #5128. ok krw@
-rw-r--r--sys/dev/cardbus/ohci_cardbus.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/dev/cardbus/ohci_cardbus.c b/sys/dev/cardbus/ohci_cardbus.c
index 70be7879b6f..598640d37e1 100644
--- a/sys/dev/cardbus/ohci_cardbus.c
+++ b/sys/dev/cardbus/ohci_cardbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ohci_cardbus.c,v 1.4 2005/12/30 04:01:18 dlg Exp $ */
+/* $OpenBSD: ohci_cardbus.c,v 1.5 2006/05/22 15:58:00 dlg Exp $ */
/* $NetBSD: ohci_cardbus.c,v 1.19 2004/08/02 19:14:28 mycroft Exp $ */
/*
@@ -188,7 +188,9 @@ ohci_cardbus_detach(struct device *self, int flags)
rv = ohci_detach(&sc->sc, flags);
if (rv)
return (rv);
- powerhook_disestablish(sc->sc.sc_powerhook);
+
+ if (sc->sc.sc_powerhook != NULL)
+ powerhook_disestablish(sc->sc.sc_powerhook);
if (sc->sc_ih != NULL) {
cardbus_intr_disestablish(sc->sc_cc, sc->sc_cf, sc->sc_ih);