Module Name: src
Committed By: nakayama
Date: Tue Sep 25 06:55:23 UTC 2018
Modified Files:
src/sys/dev/pad: pad.c
Log Message:
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.57 -r1.58 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.57 src/sys/dev/pad/pad.c:1.58
--- src/sys/dev/pad/pad.c:1.57 Tue Sep 25 06:53:49 2018
+++ src/sys/dev/pad/pad.c Tue Sep 25 06:55:23 2018
@@ -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 <[email protected]>
@@ -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 @@ 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;
}
@@ -800,6 +802,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;
}