Source-Changes-HG archive

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

[src/trunk]: src/sys/dev audio: don't use an uninitialized variable.



details:   https://anonhg.NetBSD.org/src/rev/93b12ba178db
branches:  trunk
changeset: 819798:93b12ba178db
user:      maya <maya%NetBSD.org@localhost>
date:      Sat Dec 17 17:04:04 2016 +0000

description:
audio: don't use an uninitialized variable.

PR kern/51717: audioattach erroneously fails due to uninitialized variable
from flxd.

while here, switch to use aprint_error_dev.

diffstat:

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

diffs (54 lines):

diff -r cd2090aa66b3 -r 93b12ba178db sys/dev/audio.c
--- a/sys/dev/audio.c   Sat Dec 17 16:08:29 2016 +0000
+++ b/sys/dev/audio.c   Sat Dec 17 17:04:04 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: audio.c,v 1.284 2016/12/17 16:08:29 christos Exp $     */
+/*     $NetBSD: audio.c,v 1.285 2016/12/17 17:04:04 maya 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.284 2016/12/17 16:08:29 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.285 2016/12/17 17:04:04 maya Exp $");
 
 #include "audio.h"
 #if NAUDIO > 0
@@ -575,7 +575,8 @@
                        if (sc->sc_pr.s.start != NULL)
                                audio_free_ring(sc, &sc->sc_pr);
                        sc->hw_if = NULL;
-                       aprint_error("audio: could not allocate play buffer\n");
+                       aprint_error_dev(sc->sc_dev, "could not allocate play "
+                           "buffer\n");
                        return;
                }
        }
@@ -596,8 +597,8 @@
                        if (sc->sc_vchan[0]->sc_mpr.s.start != 0)
                                audio_free_ring(sc, &sc->sc_vchan[0]->sc_mpr);
                        sc->hw_if = NULL;
-                       aprint_error("audio: could not allocate record "
-                          "buffer\n");
+                       aprint_error_dev(sc->sc_dev, "could not allocate record"
+                          " buffer\n");
                        return;
                }
        }
@@ -605,11 +606,12 @@
        sc->sc_lastgain = 128;
        sc->sc_saturate = true;
 
-       audio_set_vchan_defaults(sc, AUMODE_PLAY | AUMODE_PLAY_ALL |
+       error = audio_set_vchan_defaults(sc, AUMODE_PLAY | AUMODE_PLAY_ALL |
            AUMODE_RECORD, &vaudio_formats[0], 0);
        mutex_exit(sc->sc_lock);
        if (error != 0) {
-               aprint_error("audioattach: audio_set_defaults() failed\n");
+               aprint_error_dev(sc->sc_dev, "%s: audio_set_vchan_defaults() "
+                   "failed\n", __func__);
                sc->hw_if = NULL;
                return;
        }



Home | Main Index | Thread Index | Old Index