summaryrefslogtreecommitdiff
path: root/sys/dev/usb
diff options
context:
space:
mode:
authorriastradh <riastradh@NetBSD.org>2022-03-03 05:48:45 +0000
committerriastradh <riastradh@NetBSD.org>2022-03-03 05:48:45 +0000
commite349726d97064cd951baa82c90ff70484af54a29 (patch)
treee8bb965b810a9f78022bcc62bbe54a3becf08d51 /sys/dev/usb
parent3aaa99d2bb70021ce0af7619833ef66846b60385 (diff)
usbnet: Omit needless callout_halt and usb_rem_task_wait.
The callout and tasks cannot be pending at this point -- it is a bug if usbnet_if_stop failed to quiesce everything, so turn these into KASSERTs.
Diffstat (limited to 'sys/dev/usb')
-rw-r--r--sys/dev/usb/usbnet.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/sys/dev/usb/usbnet.c b/sys/dev/usb/usbnet.c
index f8652dadcaa..082ba4483b0 100644
--- a/sys/dev/usb/usbnet.c
+++ b/sys/dev/usb/usbnet.c
@@ -1,4 +1,4 @@
-/* $NetBSD: usbnet.c,v 1.58 2022/03/03 05:48:37 riastradh Exp $ */
+/* $NetBSD: usbnet.c,v 1.59 2022/03/03 05:48:45 riastradh Exp $ */
/*
* Copyright (c) 2019 Matthew R. Green
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.58 2022/03/03 05:48:37 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.59 2022/03/03 05:48:45 riastradh Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -1601,9 +1601,13 @@ usbnet_detach(device_t self, int flags)
}
IFNET_UNLOCK(ifp);
- callout_halt(&unp->unp_stat_ch, NULL);
- usb_rem_task_wait(un->un_udev, &unp->unp_ticktask, USB_TASKQ_DRIVER,
- NULL);
+ /*
+ * The callout and tick task can't be scheduled anew at this
+ * point, and usbnet_if_stop has waited for them to complete.
+ */
+ KASSERT(!callout_pending(&unp->unp_stat_ch));
+ KASSERT(!usb_task_pending(un->un_udev, &unp->unp_ticktask));
+
usb_rem_task_wait(un->un_udev, &unp->unp_mcasttask, USB_TASKQ_DRIVER,
NULL);