Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pad pad(4) mixer has only 1 channel, so return EINVA...



details:   https://anonhg.NetBSD.org/src/rev/fbaaeb43238a
branches:  trunk
changeset: 433643:fbaaeb43238a
user:      nakayama <nakayama%NetBSD.org@localhost>
date:      Tue Sep 25 06:55:23 2018 +0000

description:
pad(4) mixer has only 1 channel, so return EINVAL in the case other than 1.

This fixes the following strange output of mixerctl(1):

        outputs.master=255,0
        inputs.dac=255,0

diffstat:

 sys/dev/pad/pad.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (36 lines):

diff -r 1f4657028661 -r fbaaeb43238a sys/dev/pad/pad.c
--- a/sys/dev/pad/pad.c Tue Sep 25 06:53:49 2018 +0000
+++ b/sys/dev/pad/pad.c Tue Sep 25 06:55:23 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pad.c,v 1.57 2018/09/25 06:53:49 nakayama Exp $ */
+/* $NetBSD: pad.c,v 1.58 2018/09/25 06:55:23 nakayama Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.57 2018/09/25 06:53:49 nakayama Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.58 2018/09/25 06:55:23 nakayama Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -781,6 +781,8 @@
        switch (mc->dev) {
        case PAD_OUTPUT_MASTER_VOLUME:
        case PAD_INPUT_DAC_VOLUME:
+               if (mc->un.value.num_channels != 1)
+                       return EINVAL;
                sc->sc_swvol = mc->un.value.level[AUDIO_MIXER_LEVEL_MONO];
                return 0;
        }
@@ -800,6 +802,8 @@
        switch (mc->dev) {
        case PAD_OUTPUT_MASTER_VOLUME:
        case PAD_INPUT_DAC_VOLUME:
+               if (mc->un.value.num_channels != 1)
+                       return EINVAL;
                mc->un.value.level[AUDIO_MIXER_LEVEL_MONO] = sc->sc_swvol;
                return 0;
        }



Home | Main Index | Thread Index | Old Index