diff options
| author | nat <nat@NetBSD.org> | 2017-07-25 13:29:16 +0000 |
|---|---|---|
| committer | nat <nat@NetBSD.org> | 2017-07-25 13:29:16 +0000 |
| commit | 41bd6cc997bc6ececd6ce4fb096d90a5e2ff54b0 (patch) | |
| tree | f5b476eab73559260bebb46be5749c3f6c99ff1d /sys/dev/audio.c | |
| parent | 57b1b5f1dafc668735523ed1fb5e6d8c59d66039 (diff) | |
Fix a panic caused by opening pad(4)'s mixer before the corresponding
audio device has attached.
Addresses PR kern/52424.
Diffstat (limited to 'sys/dev/audio.c')
| -rw-r--r-- | sys/dev/audio.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/dev/audio.c b/sys/dev/audio.c index 7f7bc03b3cb..08b9b3a1dc8 100644 --- a/sys/dev/audio.c +++ b/sys/dev/audio.c @@ -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> @@ -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 *sc, mixer_devinfo_t *di) 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 *sc, mixer_devinfo_t *di) return 0; } - +hardware: return sc->hw_if->query_devinfo(sc->hw_hdl, di); } |
