Source-Changes-HG archive

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

[src/trunk]: src/sys/dev Fix a panic caused by opening pad(4)'s mixer before ...



details:   https://anonhg.NetBSD.org/src/rev/acb3a7912f2b
branches:  trunk
changeset: 825618:acb3a7912f2b
user:      nat <nat%NetBSD.org@localhost>
date:      Tue Jul 25 13:29:16 2017 +0000

description:
Fix a panic caused by opening pad(4)'s mixer before the corresponding
audio device has attached.

Addresses PR kern/52424.

diffstat:

 sys/dev/audio.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (37 lines):

diff -r bbad92091fba -r acb3a7912f2b sys/dev/audio.c
--- a/sys/dev/audio.c   Tue Jul 25 10:43:40 2017 +0000
+++ b/sys/dev/audio.c   Tue Jul 25 13:29:16 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: audio.c,v 1.368 2017/07/09 12:08:39 isaki Exp $        */
+/*     $NetBSD: audio.c,v 1.369 2017/07/25 13:29:16 nat Exp $  */
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss <nathanialsloss%yahoo.com.au@localhost>
@@ -148,7 +148,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.368 2017/07/09 12:08:39 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.369 2017/07/25 13:29:16 nat Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -5807,6 +5807,9 @@
 
        KASSERT(mutex_owned(sc->sc_lock));
 
+       if (sc->sc_static_nmixer_states == 0 || sc->sc_nmixer_states == 0)
+               goto hardware;
+
        if (di->index >= sc->sc_static_nmixer_states - 1 &&
            di->index < sc->sc_nmixer_states) {
                if (di->index == sc->sc_static_nmixer_states - 1) {
@@ -5838,7 +5841,7 @@
                return 0;
        }
 
-
+hardware:
        return sc->hw_if->query_devinfo(sc->hw_hdl, di);
 }
 



Home | Main Index | Thread Index | Old Index