diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2016-11-06 12:58:02 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2016-11-06 12:58:02 +0000 |
commit | 6eeb72ef4d657c28b7dd544e0c3f5b4651f5dc2b (patch) | |
tree | 4bb2419baa6f5f1486fa4b6962e05f3f945b75e9 /sys/dev/usb/uow.c | |
parent | ec6542fb7881ba68a65ceed9919c89afe7d5529a (diff) |
Avoid calling usbd_set_config_no() 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.
This is similar to the change to avoid calling usbd_set_config_index().
Diffstat (limited to 'sys/dev/usb/uow.c')
-rw-r--r-- | sys/dev/usb/uow.c | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/sys/dev/usb/uow.c b/sys/dev/usb/uow.c index 13231a4c8ec..193ea59c85b 100644 --- a/sys/dev/usb/uow.c +++ b/sys/dev/usb/uow.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uow.c,v 1.34 2015/08/31 07:32:15 mpi Exp $ */ +/* $OpenBSD: uow.c,v 1.35 2016/11/06 12:58:01 mpi Exp $ */ /* * Copyright (c) 2006 Alexander Yurchenko <grange@openbsd.org> @@ -100,7 +100,7 @@ uow_match(struct device *parent, void *match, void *aux) { struct usb_attach_arg *uaa = aux; - if (uaa->iface != NULL) + if (uaa->iface == NULL || uaa->configno != DS2490_USB_CONFIG) return (UMATCH_NONE); return ((usb_lookup(uow_devs, uaa->vendor, uaa->product) != NULL) ? @@ -121,15 +121,6 @@ uow_attach(struct device *parent, struct device *self, void *aux) sc->sc_udev = uaa->device; - /* Set USB configuration */ - if ((error = usbd_set_config_no(sc->sc_udev, - DS2490_USB_CONFIG, 0)) != 0) { - printf("%s: failed to set config %d: %s\n", - sc->sc_dev.dv_xname, DS2490_USB_CONFIG, - usbd_errstr(error)); - return; - } - /* Get interface handle */ if ((error = usbd_device2interface_handle(sc->sc_udev, DS2490_USB_IFACE, &sc->sc_iface)) != 0) { |