Module Name:    src
Committed By:   riastradh
Date:           Sun Oct 23 23:03:13 UTC 2022

Modified Files:
        src/sys/dev: midi.c

Log Message:
midi(4): Explain what's about to happen when refcnt drain fails.

This should really be an unconditional cv_wait loop, but for now
let's just give fair warning when the driver is about to puke its
guts out in case the I/O paths I haven't audited yet are buggy.


To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.100 src/sys/dev/midi.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/midi.c
diff -u src/sys/dev/midi.c:1.99 src/sys/dev/midi.c:1.100
--- src/sys/dev/midi.c:1.99	Sun Oct 23 23:02:50 2022
+++ src/sys/dev/midi.c	Sun Oct 23 23:03:13 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: midi.c,v 1.99 2022/10/23 23:02:50 riastradh Exp $	*/
+/*	$NetBSD: midi.c,v 1.100 2022/10/23 23:03:13 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: midi.c,v 1.99 2022/10/23 23:02:50 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: midi.c,v 1.100 2022/10/23 23:03:13 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "midi.h"
@@ -211,6 +211,10 @@ mididetach(device_t self, int flags)
 
 	if (--sc->refcnt >= 0) {
 		(void)cv_timedwait(&sc->detach_cv, sc->lock, hz * 60);
+		if (sc->refcnt >= 0) {
+			aprint_error_dev(self, "refcnt failed to drain,"
+			    " bashing my brains out anyway\n");
+		}
 	}
 	mutex_exit(sc->lock);
 

Reply via email to