diff options
author | Mark Brown <broonie@kernel.org> | 2022-11-24 13:19:02 +0000 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2022-11-24 13:19:02 +0000 |
commit | 81cb291eaf56a2b4aebd2aeb4070d6f049da4343 (patch) | |
tree | 8c003f185ed7b344beae0ee6321a648b77fee2b1 /sound/soc/soc-ops.c | |
parent | db8f91d424fe0ea6db337aca8bc05908bbce1498 (diff) | |
parent | 19c5bda74dc45fee598a57600b550c9ea7662f10 (diff) |
ASoC: Merge dropped fixes from v5.18
These fixes were queued for v5.18 but due to me changing my scripting
they never actually got merged - pulling them up now.
Diffstat (limited to 'sound/soc/soc-ops.c')
-rw-r--r-- | sound/soc/soc-ops.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sound/soc/soc-ops.c b/sound/soc/soc-ops.c index bd88de056358..1970bda074d8 100644 --- a/sound/soc/soc-ops.c +++ b/sound/soc/soc-ops.c @@ -452,7 +452,7 @@ int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol, val = ucontrol->value.integer.value[0]; if (mc->platform_max && val > mc->platform_max) return -EINVAL; - if (val > max - min) + if (val > max) return -EINVAL; val_mask = mask << shift; val = (val + min) & mask; @@ -468,6 +468,12 @@ int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol, val_mask = mask << rshift; val2 = (ucontrol->value.integer.value[1] + min) & mask; + + if (mc->platform_max && val2 > mc->platform_max) + return -EINVAL; + if (val2 > max) + return -EINVAL; + val2 = val2 << rshift; err = snd_soc_component_update_bits(component, reg2, val_mask, |