ASoC: Fixes for v5.17

A few more fixes for v5.17, one followup to the bounds checking fixes
 handling controls which support negative values internally and a driver
 specific one.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmIWK1EACgkQJNaLcl1U
 h9Dkuwf/WJfavINTmmR9P+RyIZAO4IjDm75Gjn6QjxiWgrmFPs9hnsd++aDZeyWT
 8A2kcBbJY57AOfWDi66O9APDDNTVKy/0tqt9TKNmw7xxja8keE98RNRWVnnbTILU
 HZ3FC25chSQ/dMykv6Rd5FuJH6Axc0VOE9NTGWy158lTXVnYqaxcPWnJfIe0yMHO
 /3M5s9GL9iasXII50CRLAfhPfDQOHElYvrYyuNmjzSkYnGlTD0lckao7+SSchHfB
 X4YMEdCBnzf9GaSG4uBLGRJmgUgvyE2LJU3kZ7VIxT0FREpD3we0MXWcOmMrVvok
 yrYQTsqjVF2ai3rNNj0MH8CkuXPR5Q==
 =EAZn
 -----END PGP SIGNATURE-----

Merge tag 'asoc-fix-v5.17-rc5' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus

ASoC: Fixes for v5.17

A few more fixes for v5.17, one followup to the bounds checking fixes
handling controls which support negative values internally and a driver
specific one.
This commit is contained in:
Takashi Iwai 2022-02-23 15:06:48 +01:00
commit ce345f1e48
2 changed files with 3 additions and 4 deletions

View File

@ -150,7 +150,6 @@ static const struct snd_kcontrol_new cs4265_snd_controls[] = {
SOC_SINGLE("E to F Buffer Disable Switch", CS4265_SPDIF_CTL1,
6, 1, 0),
SOC_ENUM("C Data Access", cam_mode_enum),
SOC_SINGLE("SPDIF Switch", CS4265_SPDIF_CTL2, 5, 1, 1),
SOC_SINGLE("Validity Bit Control Switch", CS4265_SPDIF_CTL2,
3, 1, 0),
SOC_ENUM("SPDIF Mono/Stereo", spdif_mono_stereo_enum),
@ -186,7 +185,7 @@ static const struct snd_soc_dapm_widget cs4265_dapm_widgets[] = {
SND_SOC_DAPM_SWITCH("Loopback", SND_SOC_NOPM, 0, 0,
&loopback_ctl),
SND_SOC_DAPM_SWITCH("SPDIF", SND_SOC_NOPM, 0, 0,
SND_SOC_DAPM_SWITCH("SPDIF", CS4265_SPDIF_CTL2, 5, 1,
&spdif_switch),
SND_SOC_DAPM_SWITCH("DAC", CS4265_PWRCTL, 1, 1,
&dac_switch),

View File

@ -319,7 +319,7 @@ int snd_soc_put_volsw(struct snd_kcontrol *kcontrol,
if (ucontrol->value.integer.value[0] < 0)
return -EINVAL;
val = ucontrol->value.integer.value[0];
if (mc->platform_max && val > mc->platform_max)
if (mc->platform_max && ((int)val + min) > mc->platform_max)
return -EINVAL;
if (val > max - min)
return -EINVAL;
@ -332,7 +332,7 @@ int snd_soc_put_volsw(struct snd_kcontrol *kcontrol,
if (ucontrol->value.integer.value[1] < 0)
return -EINVAL;
val2 = ucontrol->value.integer.value[1];
if (mc->platform_max && val2 > mc->platform_max)
if (mc->platform_max && ((int)val2 + min) > mc->platform_max)
return -EINVAL;
if (val2 > max - min)
return -EINVAL;