From bb51cff8fbd3f90329b39ffdfa3feddb64671422 Mon Sep 17 00:00:00 2001 From: riastradh Date: Thu, 3 Mar 2022 06:12:49 +0000 Subject: 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. --- sys/dev/usb/usbdi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'sys/dev') diff --git a/sys/dev/usb/usbdi.c b/sys/dev/usb/usbdi.c index 82637b88826..e40b874266e 100644 --- a/sys/dev/usb/usbdi.c +++ b/sys/dev/usb/usbdi.c @@ -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 -__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 @@ usbd_transfer(struct usbd_xfer *xfer) 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; } -- cgit