summaryrefslogtreecommitdiffstats
path: root/sys/dev/pci
diff options
context:
space:
mode:
authordlg <dlg@openbsd.org>2006-05-22 16:09:21 +0000
committerdlg <dlg@openbsd.org>2006-05-22 16:09:21 +0000
commitfaa54f918d1e71683d42b980f07217ff3178c95d (patch)
tree2f854ef642106d30077eb604fd8f74981ed7cc28 /sys/dev/pci
parentDon't call powerhook_disestablish if there is no powerhook to disestablish. (diff)
downloadwireguard-openbsd-faa54f918d1e71683d42b980f07217ff3178c95d.tar.xz
wireguard-openbsd-faa54f918d1e71683d42b980f07217ff3178c95d.zip
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/pci')
-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);