Date: Mon, 13 Apr 2020 16:21:03 +0000 (UTC) From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r359870 - stable/12/sys/dev/sound/usb Message-ID: <202004131621.03DGL3d8080674@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hselasky Date: Mon Apr 13 16:21:03 2020 New Revision: 359870 URL: https://svnweb.freebsd.org/changeset/base/359870 Log: MFC r359321: Factor out USB audio mixer value range check. Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/sound/usb/uaudio.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/sound/usb/uaudio.c ============================================================================== --- stable/12/sys/dev/sound/usb/uaudio.c Mon Apr 13 16:19:45 2020 (r359869) +++ stable/12/sys/dev/sound/usb/uaudio.c Mon Apr 13 16:21:03 2020 (r359870) @@ -5376,25 +5376,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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202004131621.03DGL3d8080674>