ASoC: TLV320AIC3X: Fix kcontrol's private value use in put callback

Function snd_soc_dapm_put_volsw_aic3x misuses the kcontrol's private value
by still accessing it as bitfields even SOC_SINGLE_VALUE constructs it
as a pointer into struct soc_mixer_control after the commit
4eaa9819dc.

This was causing arbitrary register writes when touching the controls
defined with SOC_DAPM_SINGLE_AIC3X.

Signed-off-by: Eero Nurkkala <ext-eero.nurkkala@nokia.com>
Acked-by: Jarkko Nikula <jarkko.nikula@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
This commit is contained in:
Eero Nurkkala 2009-02-06 12:01:04 +02:00 коммит произвёл Mark Brown
Родитель 64ca0404ee
Коммит 4453dba54d
1 изменённых файлов: 7 добавлений и 4 удалений

Просмотреть файл

@ -165,10 +165,13 @@ static int snd_soc_dapm_put_volsw_aic3x(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol); struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol);
int reg = kcontrol->private_value & 0xff; struct soc_mixer_control *mc =
int shift = (kcontrol->private_value >> 8) & 0x0f; (struct soc_mixer_control *)kcontrol->private_value;
int mask = (kcontrol->private_value >> 16) & 0xff; unsigned int reg = mc->reg;
int invert = (kcontrol->private_value >> 24) & 0x01; unsigned int shift = mc->shift;
int max = mc->max;
unsigned int mask = (1 << fls(max)) - 1;
unsigned int invert = mc->invert;
unsigned short val, val_mask; unsigned short val, val_mask;
int ret; int ret;
struct snd_soc_dapm_path *path; struct snd_soc_dapm_path *path;