svn commit: r359321 - head/sys/dev/sound/usb
Hans Petter Selasky
hselasky at FreeBSD.org
Thu Mar 26 07:42:46 UTC 2020
Author: hselasky
Date: Thu Mar 26 07:42:36 2020
New Revision: 359321
URL: https://svnweb.freebsd.org/changeset/base/359321
Log:
Factor out USB audio mixer value range check.
MFC after: 1 week
Sponsored by: Mellanox Technologies
Modified:
head/sys/dev/sound/usb/uaudio.c
Modified: head/sys/dev/sound/usb/uaudio.c
==============================================================================
--- head/sys/dev/sound/usb/uaudio.c Thu Mar 26 07:37:00 2020 (r359320)
+++ head/sys/dev/sound/usb/uaudio.c Thu Mar 26 07:42:36 2020 (r359321)
@@ -5380,25 +5380,19 @@ uaudio_mixer_bsd2value(struct uaudio_mixer_node *mc, i
{
if (mc->type == MIX_ON_OFF) {
val = (val != 0);
- } else if (mc->type == MIX_SELECTOR) {
- if ((val < mc->minval) ||
- (val > mc->maxval)) {
- val = mc->minval;
- }
- } else {
+ } else if (mc->type != MIX_SELECTOR) {
/* compute actual volume */
val = (val * mc->mul) / 100;
/* add lower offset */
val = val + mc->minval;
-
- /* make sure we don't write a value out of range */
- if (val > mc->maxval)
- val = mc->maxval;
- else if (val < mc->minval)
- val = mc->minval;
}
+ /* make sure we don't write a value out of range */
+ if (val > mc->maxval)
+ val = mc->maxval;
+ else if (val < mc->minval)
+ val = mc->minval;
DPRINTFN(6, "type=0x%03x val=%d min=%d max=%d val=%d\n",
mc->type, val, mc->minval, mc->maxval, val);
More information about the svn-src-head
mailing list