diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2016-09-02 09:15:00 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2016-09-02 09:15:00 +0000 |
commit | fe7af4c9c3612ca0b09115f8d0312efa4fe61191 (patch) | |
tree | 10c82c7f71bb0b26e7594ccaad05b2f1a114d0b0 /sys/dev/usb/uonerng.c | |
parent | f6a9246aed352fd652bf23b51d226a965b2188ec (diff) |
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/uonerng.c')
-rw-r--r-- | sys/dev/usb/uonerng.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/sys/dev/usb/uonerng.c b/sys/dev/usb/uonerng.c index deeca861c3a..a9f81810b73 100644 --- a/sys/dev/usb/uonerng.c +++ b/sys/dev/usb/uonerng.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uonerng.c,v 1.1 2016/01/08 09:36:59 mpi Exp $ */ +/* $OpenBSD: uonerng.c,v 1.2 2016/09/02 09:14:59 mpi Exp $ */ /* * Copyright (C) 2015 Devin Reade <gdr@gno.org> * Copyright (C) 2015 Sean Levy <attila@stalphonsos.com> @@ -97,7 +97,6 @@ #define ONERNG_RF "cmd7\n" -#define ONERNG_CONFIG_INDEX 0 #define ONERNG_IFACE_CTRL_INDEX 0 #define ONERNG_IFACE_DATA_INDEX 1 @@ -150,7 +149,7 @@ uonerng_match(struct device *parent, void *match, void *aux) { struct usb_attach_arg *uaa = aux; - if (uaa->iface != NULL) + if (uaa->iface == NULL) return UMATCH_NONE; if (uaa->vendor != USB_VENDOR_OPENMOKO2 || @@ -179,13 +178,6 @@ uonerng_attach(struct device *parent, struct device *self, void *aux) usb_init_task(&sc->sc_task, uonerng_task, sc, USB_TASK_TYPE_GENERIC); - err = usbd_set_config_index(sc->sc_udev, ONERNG_CONFIG_INDEX, 1); - if (err) { - printf("%s: failed to set configuration, err=%s\n", - DEVNAME(sc), usbd_errstr(err)); - goto fail; - } - /* locate the control interface number and the data interface */ err = usbd_device2interface_handle(sc->sc_udev, ONERNG_IFACE_CTRL_INDEX, &iface); |