Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/usb usb: Assert hci doesn't synchronously complete a...



details:   https://anonhg.NetBSD.org/src/rev/01a90ea7a518
branches:  trunk
changeset: 362571:01a90ea7a518
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Thu Mar 03 06:12:49 2022 +0000

description:
usb: Assert hci doesn't synchronously complete async xfers.

The xfer callback must not be invoked synchronously, because it might
need to take a lock that the caller holds.

However, the hci might return failure to the caller, meaning the xfer
callback will not be invoked at all.

diffstat:

 sys/dev/usb/usbdi.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (29 lines):

diff -r 224d1bcd5a99 -r 01a90ea7a518 sys/dev/usb/usbdi.c
--- a/sys/dev/usb/usbdi.c       Thu Mar 03 06:12:11 2022 +0000
+++ b/sys/dev/usb/usbdi.c       Thu Mar 03 06:12:49 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usbdi.c,v 1.231 2022/03/03 06:12:11 riastradh Exp $    */
+/*     $NetBSD: usbdi.c,v 1.232 2022/03/03 06:12:49 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.231 2022/03/03 06:12:11 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.232 2022/03/03 06:12:49 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -452,8 +452,8 @@
        if (!(flags & USBD_SYNCHRONOUS)) {
                USBHIST_LOG(usbdebug, "<- done xfer %#jx, not sync (err %jd)",
                    (uintptr_t)xfer, err, 0, 0);
-               if (err != USBD_IN_PROGRESS) /* XXX Possible?  */
-                       SDT_PROBE2(usb, device, xfer, done,  xfer, err);
+               KASSERTMSG(err != USBD_NORMAL_COMPLETION,
+                   "asynchronous xfer %p completed synchronously", xfer);
                return err;
        }
 



Home | Main Index | Thread Index | Old Index