Date: Mon, 13 Apr 2020 16:21:39 +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-11@freebsd.org Subject: svn commit: r359871 - stable/11/sys/dev/sound/usb Message-ID: <202004131621.03DGLdZf080765@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hselasky Date: Mon Apr 13 16:21:38 2020 New Revision: 359871 URL: https://svnweb.freebsd.org/changeset/base/359871 Log: MFC r359321: Factor out USB audio mixer value range check. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/sound/usb/uaudio.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/sound/usb/uaudio.c ============================================================================== --- stable/11/sys/dev/sound/usb/uaudio.c Mon Apr 13 16:21:03 2020 (r359870) +++ stable/11/sys/dev/sound/usb/uaudio.c Mon Apr 13 16:21:38 2020 (r359871) @@ -5374,25 +5374,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.03DGLdZf080765>