summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb/usb.c
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2010-08-31 16:38:42 +0000
committerderaadt <deraadt@openbsd.org>2010-08-31 16:38:42 +0000
commit26dcf4f76c33462b59103acd0432e0e69a3b1037 (patch)
treeca2650b00a71ecc4fed1d6e27995aecdda1a29db /sys/dev/usb/usb.c
parentin the activate function, order the DVACT_ functions in the order they (diff)
downloadwireguard-openbsd-26dcf4f76c33462b59103acd0432e0e69a3b1037.tar.xz
wireguard-openbsd-26dcf4f76c33462b59103acd0432e0e69a3b1037.zip
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/usb/usb.c')
-rw-r--r--sys/dev/usb/usb.c12
1 files changed, 7 insertions, 5 deletions
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;
}