summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorriastradh <riastradh@NetBSD.org>2021-06-12 15:09:18 +0000
committerriastradh <riastradh@NetBSD.org>2021-06-12 15:09:18 +0000
commit57131f3fe0b404bf2482cf23eb565cb202235bf7 (patch)
treefe11e0254b86bb725ce568e9c486419245d588de /sys/dev
parent0c3f879fbf733ede2e219addb59e33b061c4b994 (diff)
Revert "usb(4): Fix mistake in previous fix for pipe/interface-change races."
Little too fast on the commit trigger there before testing, oops. We don't have the pipe yet until usbd_setup_pipe_flags returns!
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/usb/usbdi.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/sys/dev/usb/usbdi.c b/sys/dev/usb/usbdi.c
index a74d67ecba1..37f60b743db 100644
--- a/sys/dev/usb/usbdi.c
+++ b/sys/dev/usb/usbdi.c
@@ -1,4 +1,4 @@
-/* $NetBSD: usbdi.c,v 1.209 2021/06/12 14:57:53 riastradh Exp $ */
+/* $NetBSD: usbdi.c,v 1.210 2021/06/12 15:09:18 riastradh Exp $ */
/*
* Copyright (c) 1998, 2012, 2015 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.209 2021/06/12 14:57:53 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.210 2021/06/12 15:09:18 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -241,16 +241,12 @@ usbd_open_pipe_ival(struct usbd_interface *iface, uint8_t address,
}
return USBD_BAD_ADDRESS;
found:
+ err = usbd_setup_pipe_flags(iface->ui_dev, iface, ep, ival, &p, flags);
+ if (err)
+ return err;
mutex_enter(&iface->ui_pipelock);
LIST_INSERT_HEAD(&iface->ui_pipes, p, up_next);
mutex_exit(&iface->ui_pipelock);
- err = usbd_setup_pipe_flags(iface->ui_dev, iface, ep, ival, &p, flags);
- if (err) {
- mutex_enter(&iface->ui_pipelock);
- LIST_REMOVE(p, up_next);
- mutex_exit(&iface->ui_pipelock);
- return err;
- }
*pipe = p;
SDT_PROBE5(usb, device, pipe, open,
iface, address, flags, ival, p);