Module Name:    src
Committed By:   martin
Date:           Wed Oct  3 17:50:57 UTC 2018

Modified Files:
        src/sys/dev/pad [netbsd-8]: pad.c

Log Message:
Pull up following revision(s) (requested by nakayama in ticket #1044):

        sys/dev/pad/pad.c: revision 1.58

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


To generate a diff of this commit:
cvs rdiff -u -r1.32.2.2 -r1.32.2.3 src/sys/dev/pad/pad.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/pad/pad.c
diff -u src/sys/dev/pad/pad.c:1.32.2.2 src/sys/dev/pad/pad.c:1.32.2.3
--- src/sys/dev/pad/pad.c:1.32.2.2	Sat Dec 23 18:48:41 2017
+++ src/sys/dev/pad/pad.c	Wed Oct  3 17:50:57 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: pad.c,v 1.32.2.2 2017/12/23 18:48:41 snj Exp $ */
+/* $NetBSD: pad.c,v 1.32.2.3 2018/10/03 17:50:57 martin Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill <jmcne...@invisible.ca>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.32.2.2 2017/12/23 18:48:41 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.32.2.3 2018/10/03 17:50:57 martin Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -572,6 +572,8 @@ pad_set_port(void *opaque, mixer_ctrl_t 
 	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;
 	}
@@ -591,6 +593,8 @@ pad_get_port(void *opaque, mixer_ctrl_t 
 	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;
 	}

Reply via email to