Source-Changes-HG archive

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

[src/trunk]: src/sys/dev Clean up audio_open().



details:   https://anonhg.NetBSD.org/src/rev/5563e71d6ea6
branches:  trunk
changeset: 826089:5563e71d6ea6
user:      isaki <isaki%NetBSD.org@localhost>
date:      Tue Aug 15 05:31:52 2017 +0000

description:
Clean up audio_open().
As a result of sc_audiochan cleanup, this loop is the same as last + 1.

diffstat:

 sys/dev/audio.c |  11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diffs (34 lines):

diff -r 8f9cb1aa4625 -r 5563e71d6ea6 sys/dev/audio.c
--- a/sys/dev/audio.c   Tue Aug 15 05:11:25 2017 +0000
+++ b/sys/dev/audio.c   Tue Aug 15 05:31:52 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: audio.c,v 1.396 2017/08/15 05:11:25 isaki Exp $        */
+/*     $NetBSD: audio.c,v 1.397 2017/08/15 05:31:52 isaki 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.396 2017/08/15 05:11:25 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.397 2017/08/15 05:31:52 isaki Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -2124,12 +2124,11 @@
        hw = sc->hw_if;
        if (hw == NULL)
                return ENXIO;
+
        n = 1;
-       SIMPLEQ_FOREACH(chan, &sc->sc_audiochan, entries) {
+       chan = SIMPLEQ_LAST(&sc->sc_audiochan, audio_chan, entries);
+       if (chan != NULL)
                n = chan->chan + 1;
-       }
-       if (n < 0)
-               return ENOMEM;
 
        chan = kmem_zalloc(sizeof(struct audio_chan), KM_SLEEP);
        vc = kmem_zalloc(sizeof(struct virtual_channel), KM_SLEEP);



Home | Main Index | Thread Index | Old Index