Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb udav(4): Stop asserting !usbnet_isdying.



details:   https://anonhg.NetBSD.org/src/rev/8fc07ed30ddb
branches:  trunk
changeset: 362535:8fc07ed30ddb
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Thu Mar 03 05:53:56 2022 +0000

description:
udav(4): Stop asserting !usbnet_isdying.

This can change at any moment; no software lock can prevent the
device from being detached.  Any test of it is necessarily
best-effort just to avoid wasting time later on waiting for requests
to fail or time out.

diffstat:

 sys/dev/usb/if_udav.c |  13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diffs (48 lines):

diff -r 92b48c6c4cfa -r 8fc07ed30ddb sys/dev/usb/if_udav.c
--- a/sys/dev/usb/if_udav.c     Thu Mar 03 05:53:48 2022 +0000
+++ b/sys/dev/usb/if_udav.c     Thu Mar 03 05:53:56 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_udav.c,v 1.89 2022/03/03 05:53:33 riastradh Exp $   */
+/*     $NetBSD: if_udav.c,v 1.90 2022/03/03 05:53:56 riastradh Exp $   */
 /*     $nabe: if_udav.c,v 1.3 2003/08/21 16:57:19 nabe Exp $   */
 
 /*
@@ -45,7 +45,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_udav.c,v 1.89 2022/03/03 05:53:33 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_udav.c,v 1.90 2022/03/03 05:53:56 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -364,7 +364,8 @@
        usb_device_request_t req;
        usbd_status err;
 
-       KASSERT(!usbnet_isdying(un));
+       if (usbnet_isdying(un))
+               return USBD_IOERROR;
 
        DPRINTFN(0x200,
                ("%s: %s: enter\n", device_xname(un->un_dev), __func__));
@@ -394,7 +395,8 @@
        usb_device_request_t req;
        usbd_status err;
 
-       KASSERT(!usbnet_isdying(un));
+       if (usbnet_isdying(un))
+               return USBD_IOERROR;
 
        DPRINTFN(0x200,
                ("%s: %s: enter\n", device_xname(un->un_dev), __func__));
@@ -438,7 +440,8 @@
        usb_device_request_t req;
        usbd_status err;
 
-       KASSERT(!usbnet_isdying(un));
+       if (usbnet_isdying(un))
+               return USBD_IOERROR;
 
        DPRINTFN(0x200,
                ("%s: %s: enter\n", device_xname(un->un_dev), __func__));



Home | Main Index | Thread Index | Old Index