summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2006-05-22 16:09:22 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2006-05-22 16:09:22 +0000
commit68072f65efba1f32026413c8b503f7a685ddab18 (patch)
tree409d015424a116d337d360e6c2c1c499db4ce618 /sys/dev
parent6ed99fd1912cfe624091790de26540a1cc873c4f (diff)
Warn the user if the powerhook could not be established during attach. For
extra correctness check that it is set before trying to disestablish it at detach. Whether you can detach a pci ohci controller is a separate issue. Inspired by krw@'s change in ohci.c 1.67 for PR #5128. ok krw@
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/ohci_pci.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/dev/pci/ohci_pci.c b/sys/dev/pci/ohci_pci.c
index b694ace825c..67751c585c8 100644
--- a/sys/dev/pci/ohci_pci.c
+++ b/sys/dev/pci/ohci_pci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ohci_pci.c,v 1.28 2006/05/22 15:52:48 krw Exp $ */
+/* $OpenBSD: ohci_pci.c,v 1.29 2006/05/22 16:09:21 dlg Exp $ */
/* $NetBSD: ohci_pci.c,v 1.23 2002/10/02 16:51:47 thorpej Exp $ */
/*
@@ -169,6 +169,9 @@ ohci_pci_attach(struct device *parent, struct device *self, void *aux)
}
sc->sc.sc_powerhook = powerhook_establish(ohci_power, &sc->sc);
+ if (sc->sc.sc_powerhook == NULL)
+ printf("%s: unable to establish powerhook\n",
+ sc->sc.sc_bus.bdev.dv_xname);
splx(s);
@@ -187,7 +190,8 @@ ohci_pci_detach(struct device *self, int 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) {
pci_intr_disestablish(sc->sc_pc, sc->sc_ih);