Module Name: src
Committed By: riastradh
Date: Sat Jan 13 18:22:13 UTC 2024
Modified Files:
src/sys/dev/usb: usbdi.c
Log Message:
usbdi(9): Assert not polling in abort path.
XXX Not sure if this is safe.
To generate a diff of this commit:
cvs rdiff -u -r1.249 -r1.250 src/sys/dev/usb/usbdi.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/usb/usbdi.c
diff -u src/sys/dev/usb/usbdi.c:1.249 src/sys/dev/usb/usbdi.c:1.250
--- src/sys/dev/usb/usbdi.c:1.249 Sat Jan 13 12:42:10 2024
+++ src/sys/dev/usb/usbdi.c Sat Jan 13 18:22:13 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: usbdi.c,v 1.249 2024/01/13 12:42:10 riastradh Exp $ */
+/* $NetBSD: usbdi.c,v 1.250 2024/01/13 18:22:13 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.249 2024/01/13 12:42:10 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.250 2024/01/13 18:22:13 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -417,11 +417,9 @@ usbd_transfer(struct usbd_xfer *xfer)
* XXX For synchronous transfers this is fine. What to
* do for asynchronous transfers? The callback is
* never run, not even with status USBD_CANCELLED.
- *
- * XXX Does it make sense to abort while polling?
*/
- if (pipe->up_dev->ud_bus->ub_usepolling == 0)
- usbd_unlock_pipe(pipe);
+ KASSERT(pipe->up_dev->ud_bus->ub_usepolling == 0);
+ usbd_unlock_pipe(pipe);
USBHIST_LOG(usbdebug, "<- done xfer %#jx, aborting",
(uintptr_t)xfer, 0, 0, 0);
SDT_PROBE2(usb, device, xfer, done, xfer, USBD_CANCELLED);
@@ -1036,6 +1034,7 @@ usbd_ar_pipe(struct usbd_pipe *pipe)
ASSERT_SLEEPABLE();
KASSERT(mutex_owned(pipe->up_dev->ud_bus->ub_lock));
+ KASSERT(pipe->up_dev->ud_bus->ub_usepolling == 0);
/*
* Allow only one thread at a time to abort the pipe, so we