summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2010-08-31 16:38:43 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2010-08-31 16:38:43 +0000
commitb7132ea09284b20694fbc666307e8eac41f69de1 (patch)
treef9e8de14d8faebd625b7d687a1daa1c72edfb5f2 /sys/dev
parent57091ba13b8a979e4d0e69b1e99be79155d77ed0 (diff)
In xxactivate() DVACT_DEACTIVATE, when calling a series of config_deactivate()
for sub-devices, return the last error return value instead of |'ing the failures together and creating some value that is non-0 (bravo!) but potentially loses the specific error value...
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/usb/uhidev.c14
-rw-r--r--sys/dev/usb/usb.c12
-rw-r--r--sys/dev/usb/uvisor.c13
3 files changed, 22 insertions, 17 deletions
diff --git a/sys/dev/usb/uhidev.c b/sys/dev/usb/uhidev.c
index c15084b7cf6..ec3fcfdc17b 100644
--- a/sys/dev/usb/uhidev.c
+++ b/sys/dev/usb/uhidev.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uhidev.c,v 1.38 2010/08/02 23:17:34 miod Exp $ */
+/* $OpenBSD: uhidev.c,v 1.39 2010/08/31 16:38:42 deraadt Exp $ */
/* $NetBSD: uhidev.c,v 1.14 2003/03/11 16:44:00 augustss Exp $ */
/*
@@ -336,17 +336,19 @@ int
uhidev_activate(struct device *self, int act)
{
struct uhidev_softc *sc = (struct uhidev_softc *)self;
- int i, rv = 0;
+ int i, rv = 0, r;
switch (act) {
case DVACT_ACTIVATE:
break;
-
case DVACT_DEACTIVATE:
for (i = 0; i < sc->sc_nrepid; i++)
- if (sc->sc_subdevs[i] != NULL)
- rv |= config_deactivate(
- &sc->sc_subdevs[i]->sc_dev);
+ if (sc->sc_subdevs[i] != NULL) {
+ r = config_deactivate(
+ &sc->sc_subdevs[i]->sc_dev);
+ if (r)
+ rv = r;
+ }
sc->sc_dying = 1;
break;
}
diff --git a/sys/dev/usb/usb.c b/sys/dev/usb/usb.c
index 21a8a07fbef..6d9127df792 100644
--- a/sys/dev/usb/usb.c
+++ b/sys/dev/usb/usb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: usb.c,v 1.62 2009/11/09 17:53:39 nicm Exp $ */
+/* $OpenBSD: usb.c,v 1.63 2010/08/31 16:38:42 deraadt Exp $ */
/* $NetBSD: usb.c,v 1.77 2003/01/01 00:10:26 thorpej Exp $ */
/*
@@ -790,18 +790,20 @@ usb_activate(struct device *self, int act)
{
struct usb_softc *sc = (struct usb_softc *)self;
usbd_device_handle dev = sc->sc_port.device;
- int i, rv = 0;
+ int i, rv = 0, r;
switch (act) {
case DVACT_ACTIVATE:
break;
-
case DVACT_DEACTIVATE:
sc->sc_dying = 1;
if (dev != NULL && dev->cdesc != NULL &&
dev->subdevs != NULL) {
- for (i = 0; dev->subdevs[i]; i++)
- rv |= config_deactivate(dev->subdevs[i]);
+ for (i = 0; dev->subdevs[i]; i++) {
+ r = config_deactivate(dev->subdevs[i]);
+ if (r)
+ rv = r;
+ }
}
break;
}
diff --git a/sys/dev/usb/uvisor.c b/sys/dev/usb/uvisor.c
index 7776fae58fb..754982e8edb 100644
--- a/sys/dev/usb/uvisor.c
+++ b/sys/dev/usb/uvisor.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvisor.c,v 1.40 2010/07/02 03:13:42 tedu Exp $ */
+/* $OpenBSD: uvisor.c,v 1.41 2010/08/31 16:38:42 deraadt Exp $ */
/* $NetBSD: uvisor.c,v 1.21 2003/08/03 21:59:26 nathanw Exp $ */
/*
@@ -382,17 +382,18 @@ int
uvisor_activate(struct device *self, int act)
{
struct uvisor_softc *sc = (struct uvisor_softc *)self;
- int rv = 0;
- int i;
+ int i, rv = 0, r;
switch (act) {
case DVACT_ACTIVATE:
break;
-
case DVACT_DEACTIVATE:
for (i = 0; i < sc->sc_numcon; i++)
- if (sc->sc_subdevs[i] != NULL)
- rv = config_deactivate(sc->sc_subdevs[i]);
+ if (sc->sc_subdevs[i] != NULL) {
+ r = config_deactivate(sc->sc_subdevs[i]);
+ if (r)
+ rv = r;
+ }
sc->sc_dying = 1;
break;
}