Message ID | 20221125162348.1288005-1-ckeepax@opensource.cirrus.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | [1/2] ASoC: ops: Correct bounds check for second channel on SX controls | expand |
On Fri, Nov 25, 2022 at 04:23:47PM +0000, Charles Keepax wrote:
> Fixes: e9b397afabb8 ("ASoC: ops: Check bounds for second channel in snd_soc_put_volsw_sx()")
You probably mean 97eea946b93961fffd29448dcda7398d0d51c4b2.
On Fri, Nov 25, 2022 at 04:29:57PM +0000, Mark Brown wrote: > On Fri, Nov 25, 2022 at 04:23:47PM +0000, Charles Keepax wrote: > > > Fixes: e9b397afabb8 ("ASoC: ops: Check bounds for second channel in snd_soc_put_volsw_sx()") > > You probably mean 97eea946b93961fffd29448dcda7398d0d51c4b2. Sigh, sorry about that will send a new version. Thanks, Charles
On Fri, Nov 25, 2022 at 04:35:09PM +0000, Charles Keepax wrote: > On Fri, Nov 25, 2022 at 04:29:57PM +0000, Mark Brown wrote: > > You probably mean 97eea946b93961fffd29448dcda7398d0d51c4b2. > Sigh, sorry about that will send a new version. No, it's fine.
On Fri, 25 Nov 2022 16:23:47 +0000, Charles Keepax wrote: > Currently the check against the max value for the control is being > applied after the value has had the minimum applied and been masked. But > the max value simply indicates the number of volume levels on an SX > control, and as such should just be applied on the raw value. > > Applied to https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next Thanks! [1/2] ASoC: ops: Correct bounds check for second channel on SX controls commit: f33bcc506050f89433a52a3052054d4ebd37b1c1 [2/2] ASoC: cs42l51: Correct PGA Volume minimum value commit: 3d1bb6cc1a654c8693a85b1d262e610196edec8b All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark
diff --git a/sound/soc/soc-ops.c b/sound/soc/soc-ops.c index 1970bda074d8a..55b009d3c6815 100644 --- a/sound/soc/soc-ops.c +++ b/sound/soc/soc-ops.c @@ -464,16 +464,15 @@ int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol, ret = err; if (snd_soc_volsw_is_stereo(mc)) { - unsigned int val2; - - val_mask = mask << rshift; - val2 = (ucontrol->value.integer.value[1] + min) & mask; + unsigned int val2 = ucontrol->value.integer.value[1]; if (mc->platform_max && val2 > mc->platform_max) return -EINVAL; if (val2 > max) return -EINVAL; + val_mask = mask << rshift; + val2 = (val2 + min) & mask; val2 = val2 << rshift; err = snd_soc_component_update_bits(component, reg2, val_mask,
Currently the check against the max value for the control is being applied after the value has had the minimum applied and been masked. But the max value simply indicates the number of volume levels on an SX control, and as such should just be applied on the raw value. Fixes: e9b397afabb8 ("ASoC: ops: Check bounds for second channel in snd_soc_put_volsw_sx()") Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> --- sound/soc/soc-ops.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)