Module Name:    src
Committed By:   riastradh
Date:           Thu Mar  3 05:53:56 UTC 2022

Modified Files:
        src/sys/dev/usb: if_udav.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/sys/dev/usb/if_udav.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/if_udav.c
diff -u src/sys/dev/usb/if_udav.c:1.89 src/sys/dev/usb/if_udav.c:1.90
--- src/sys/dev/usb/if_udav.c:1.89	Thu Mar  3 05:53:33 2022
+++ src/sys/dev/usb/if_udav.c	Thu Mar  3 05:53:56 2022
@@ -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 @@ udav_csr_read(struct usbnet *un, int off
 	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 @@ udav_csr_write(struct usbnet *un, int of
 	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 @@ udav_csr_write1(struct usbnet *un, int o
 	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__));

Reply via email to