summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb/uhub.c
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2016-09-02 09:14:59 +0000
committermpi <mpi@openbsd.org>2016-09-02 09:14:59 +0000
commitc0d38480dd6e96dd7a2beab2296accd573b35849 (patch)
treed31fad74dfe6b15340f5b3856cfdf9dcbc710420 /sys/dev/usb/uhub.c
parentRemove variables 'm' and 'uio' that are only ever assigned to (diff)
downloadwireguard-openbsd-c0d38480dd6e96dd7a2beab2296accd573b35849.tar.xz
wireguard-openbsd-c0d38480dd6e96dd7a2beab2296accd573b35849.zip
Avoid calling usbd_set_config_index() in *_attach() and let the stack
do it instead. If anything bad happen due to a malformed descriptor it makes no sense to try to attach a driver, and bail before probing.
Diffstat (limited to 'sys/dev/usb/uhub.c')
-rw-r--r--sys/dev/usb/uhub.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/sys/dev/usb/uhub.c b/sys/dev/usb/uhub.c
index b73a15dfb1a..55e4bd520d3 100644
--- a/sys/dev/usb/uhub.c
+++ b/sys/dev/usb/uhub.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uhub.c,v 1.88 2015/11/29 16:30:48 kettenis Exp $ */
+/* $OpenBSD: uhub.c,v 1.89 2016/09/02 09:14:59 mpi Exp $ */
/* $NetBSD: uhub.c,v 1.64 2003/02/08 03:32:51 ichiro Exp $ */
/* $FreeBSD: src/sys/dev/usb/uhub.c,v 1.18 1999/11/17 22:33:43 n_hibma Exp $ */
@@ -102,11 +102,14 @@ uhub_match(struct device *parent, void *match, void *aux)
struct usb_attach_arg *uaa = aux;
usb_device_descriptor_t *dd = usbd_get_device_descriptor(uaa->device);
+ if (uaa->iface == NULL)
+ return (UMATCH_NONE);
+
/*
* The subclass for hubs seems to be 0 for some and 1 for others,
* so we just ignore the subclass.
*/
- if (uaa->iface == NULL && dd->bDeviceClass == UDCLASS_HUB)
+ if (dd->bDeviceClass == UDCLASS_HUB)
return (UMATCH_DEVCLASS_DEVSUBCLASS);
return (UMATCH_NONE);
}
@@ -134,13 +137,6 @@ uhub_attach(struct device *parent, struct device *self, void *aux)
sc->sc_hub = dev;
- err = usbd_set_config_index(dev, 0, 1);
- if (err) {
- DPRINTF("%s: configuration failed, error=%s\n",
- sc->sc_dev.dv_xname, usbd_errstr(err));
- return;
- }
-
if (dev->depth > USB_HUB_MAX_DEPTH) {
printf("%s: hub depth (%d) exceeded, hub ignored\n",
sc->sc_dev.dv_xname, USB_HUB_MAX_DEPTH);