Module Name:    src
Committed By:   jmcneill
Date:           Sat Jan 18 12:00:33 UTC 2020

Modified Files:
        src/sys/dev/hdaudio: hdafg.c

Log Message:
Make sure we have at least one of playback or capture streams setup before
attaching the audio layer.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/hdaudio/hdafg.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/hdaudio/hdafg.c
diff -u src/sys/dev/hdaudio/hdafg.c:1.18 src/sys/dev/hdaudio/hdafg.c:1.19
--- src/sys/dev/hdaudio/hdafg.c:1.18	Sat Jun  8 08:02:38 2019
+++ src/sys/dev/hdaudio/hdafg.c	Sat Jan 18 12:00:33 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: hdafg.c,v 1.18 2019/06/08 08:02:38 isaki Exp $ */
+/* $NetBSD: hdafg.c,v 1.19 2020/01/18 12:00:33 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2009 Precedence Technologies Ltd <[email protected]>
@@ -60,7 +60,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.18 2019/06/08 08:02:38 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.19 2020/01/18 12:00:33 jmcneill Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -3781,6 +3781,12 @@ hdafg_attach(device_t parent, device_t s
 	sc->sc_audiodev.ad_playback = hdaudio_stream_establish(sc->sc_host,
 	    HDAUDIO_STREAM_OSS, hdafg_stream_intr, &sc->sc_audiodev);
 
+	if (sc->sc_audiodev.ad_capture == NULL &&
+	    sc->sc_audiodev.ad_playback == NULL) {
+		hda_error(sc, "couldn't find any input or output streams\n");
+		return;
+	}
+
 	hda_debug(sc, "connecting streams\n");
 	defparams.channels = 2;
 	defparams.sample_rate = sc->sc_fixed_rate ? sc->sc_fixed_rate : 48000;

Reply via email to