Source-Changes-HG archive

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

[src/trunk]: src/sys/dev midi(4): Explain what's about to happen when refcnt ...



details:   https://anonhg.NetBSD.org/src/rev/6ce82f3e0d49
branches:  trunk
changeset: 371983:6ce82f3e0d49
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Oct 23 23:03:13 2022 +0000

description:
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.

diffstat:

 sys/dev/midi.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (29 lines):

diff -r bdb25162b356 -r 6ce82f3e0d49 sys/dev/midi.c
--- a/sys/dev/midi.c    Sun Oct 23 23:02:50 2022 +0000
+++ b/sys/dev/midi.c    Sun Oct 23 23:03:13 2022 +0000
@@ -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 @@
 
        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);
 



Home | Main Index | Thread Index | Old Index