diff options
author | Takashi Iwai <tiwai@suse.de> | 2022-11-30 17:26:55 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2022-11-30 17:26:55 +0100 |
commit | b47068b4aa53a57552398e3f60d0ed1918700c2b (patch) | |
tree | f5e4ec1b48d94cfd7440dc7784586a5e64cf0094 /sound/soc/soc-ops.c | |
parent | 9b84f0f74d0d716e3fd18dc428ac111266ef5844 (diff) | |
parent | 3d1bb6cc1a654c8693a85b1d262e610196edec8b (diff) | |
download | linux-b47068b4aa53a57552398e3f60d0ed1918700c2b.tar.gz |
Merge tag 'asoc-fix-v6.1-rc7' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
ASoC: Fixes for v6.1
Some more fixes for v6.1, some of these are very old and were originally
intended to get sent for v5.18 but got lost in the shuffle when there
was an issue with Linus not liking my branching strategy and I rebuilt
bits of my workflow. The ops changes have been validated by people
looking at real hardware and are how things getting dropped got noticed.
Diffstat (limited to 'sound/soc/soc-ops.c')
-rw-r--r-- | sound/soc/soc-ops.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/sound/soc/soc-ops.c b/sound/soc/soc-ops.c index bd88de056358..55b009d3c681 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; @@ -464,10 +464,15 @@ int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol, ret = err; if (snd_soc_volsw_is_stereo(mc)) { - unsigned int val2; + 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 = (ucontrol->value.integer.value[1] + min) & mask; + val2 = (val2 + min) & mask; val2 = val2 << rshift; err = snd_soc_component_update_bits(component, reg2, val_mask, |