Module Name:    src
Committed By:   nakayama
Date:           Mon May 13 04:09:35 UTC 2019

Modified Files:
        src/sys/dev/audio: audio.c

Log Message:
audioattach:
Output the cause of the audio device disabled along with the error code.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/audio/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/audio.c
diff -u src/sys/dev/audio/audio.c:1.3 src/sys/dev/audio/audio.c:1.4
--- src/sys/dev/audio/audio.c:1.3	Sat May 11 03:26:43 2019
+++ src/sys/dev/audio/audio.c	Mon May 13 04:09:35 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.3 2019/05/11 03:26:43 maya Exp $	*/
+/*	$NetBSD: audio.c,v 1.4 2019/05/13 04:09:35 nakayama Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -149,7 +149,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.3 2019/05/11 03:26:43 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.4 2019/05/13 04:09:35 nakayama Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -928,12 +928,16 @@ audioattach(device_t parent, device_t se
 	memset(&pfil, 0, sizeof(pfil));
 	memset(&rfil, 0, sizeof(rfil));
 	mutex_enter(sc->sc_lock);
-	if (audio_hw_probe(sc, is_indep, &mode, &phwfmt, &rhwfmt) != 0) {
+	error = audio_hw_probe(sc, is_indep, &mode, &phwfmt, &rhwfmt);
+	if (error) {
 		mutex_exit(sc->sc_lock);
+		aprint_error_dev(self, "audio_hw_probe failed, "
+		    "error = %d\n", error);
 		goto bad;
 	}
 	if (mode == 0) {
 		mutex_exit(sc->sc_lock);
+		aprint_error_dev(self, "audio_hw_probe failed, no mode\n");
 		goto bad;
 	}
 	/* Init hardware. */
@@ -941,6 +945,8 @@ audioattach(device_t parent, device_t se
 	error = audio_hw_set_format(sc, mode, &phwfmt, &rhwfmt, &pfil, &rfil);
 	if (error) {
 		mutex_exit(sc->sc_lock);
+		aprint_error_dev(self, "audio_hw_set_format failed, "
+		    "error = %d\n", error);
 		goto bad;
 	}
 
@@ -950,8 +956,11 @@ audioattach(device_t parent, device_t se
 	 */
 	error = audio_mixers_init(sc, mode, &phwfmt, &rhwfmt, &pfil, &rfil);
 	mutex_exit(sc->sc_lock);
-	if (sc->sc_pmixer == NULL && sc->sc_rmixer == NULL)
+	if (sc->sc_pmixer == NULL && sc->sc_rmixer == NULL) {
+		aprint_error_dev(self, "audio_mixers_init failed, "
+		    "error = %d\n", error);
 		goto bad;
+	}
 
 	selinit(&sc->sc_wsel);
 	selinit(&sc->sc_rsel);

Reply via email to