Module Name: src
Committed By: nat
Date: Tue Jul 25 13:29:16 UTC 2017
Modified Files:
src/sys/dev: audio.c
Log Message:
Fix a panic caused by opening pad(4)'s mixer before the corresponding
audio device has attached.
Addresses PR kern/52424.
To generate a diff of this commit:
cvs rdiff -u -r1.368 -r1.369 src/sys/dev/audio.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/audio.c
diff -u src/sys/dev/audio.c:1.368 src/sys/dev/audio.c:1.369
--- src/sys/dev/audio.c:1.368 Sun Jul 9 12:08:39 2017
+++ src/sys/dev/audio.c Tue Jul 25 13:29:16 2017
@@ -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 <[email protected]>
@@ -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 @@ audio_query_devinfo(struct audio_softc *
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 @@ audio_query_devinfo(struct audio_softc *
return 0;
}
-
+hardware:
return sc->hw_if->query_devinfo(sc->hw_hdl, di);
}