diff options
author | Takashi Iwai <tiwai@suse.de> | 2007-11-15 09:56:07 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2008-01-31 11:29:24 -0500 |
commit | 9cd17cd2409ddbe9853575569cfd97561fa86b14 (patch) | |
tree | e41f734ccf669f6360fe1155be42e262e44a9552 /sound/pci/ice1712/wtm.c | |
parent | 68ea7b2f2d8c1effd662fded04e9a589cb640da6 (diff) |
[ALSA] ice1724 - Check value ranges in ctl callbacks
Check the value ranges in ctl put callbacks properly.
Also fixed the wrong access type to enum elements in aureon.c.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound/pci/ice1712/wtm.c')
-rw-r--r-- | sound/pci/ice1712/wtm.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sound/pci/ice1712/wtm.c b/sound/pci/ice1712/wtm.c index 7fcce0a506d6..41a153d30c51 100644 --- a/sound/pci/ice1712/wtm.c +++ b/sound/pci/ice1712/wtm.c | |||
@@ -178,7 +178,7 @@ static int stac9460_dac_vol_put(struct snd_kcontrol *kcontrol, | |||
178 | 178 | ||
179 | if (kcontrol->private_value) { | 179 | if (kcontrol->private_value) { |
180 | idx = STAC946X_MASTER_VOLUME; | 180 | idx = STAC946X_MASTER_VOLUME; |
181 | nvol = ucontrol->value.integer.value[0]; | 181 | nvol = ucontrol->value.integer.value[0] & 0x7f; |
182 | tmp = stac9460_get(ice, idx); | 182 | tmp = stac9460_get(ice, idx); |
183 | ovol = 0x7f - (tmp & 0x7f); | 183 | ovol = 0x7f - (tmp & 0x7f); |
184 | change = (ovol != nvol); | 184 | change = (ovol != nvol); |
@@ -189,7 +189,7 @@ static int stac9460_dac_vol_put(struct snd_kcontrol *kcontrol, | |||
189 | } else { | 189 | } else { |
190 | id = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | 190 | id = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
191 | idx = id + STAC946X_LF_VOLUME; | 191 | idx = id + STAC946X_LF_VOLUME; |
192 | nvol = ucontrol->value.integer.value[0]; | 192 | nvol = ucontrol->value.integer.value[0] & 0x7f; |
193 | if (id < 6) | 193 | if (id < 6) |
194 | tmp = stac9460_get(ice, idx); | 194 | tmp = stac9460_get(ice, idx); |
195 | else | 195 | else |
@@ -317,7 +317,7 @@ static int stac9460_adc_vol_put(struct snd_kcontrol *kcontrol, | |||
317 | if (id == 0) { | 317 | if (id == 0) { |
318 | for (i = 0; i < 2; ++i) { | 318 | for (i = 0; i < 2; ++i) { |
319 | reg = STAC946X_MIC_L_VOLUME + i; | 319 | reg = STAC946X_MIC_L_VOLUME + i; |
320 | nvol = ucontrol->value.integer.value[i]; | 320 | nvol = ucontrol->value.integer.value[i] & 0x0f; |
321 | ovol = 0x0f - stac9460_get(ice, reg); | 321 | ovol = 0x0f - stac9460_get(ice, reg); |
322 | change = ((ovol & 0x0f) != nvol); | 322 | change = ((ovol & 0x0f) != nvol); |
323 | if (change) | 323 | if (change) |
@@ -327,7 +327,7 @@ static int stac9460_adc_vol_put(struct snd_kcontrol *kcontrol, | |||
327 | } else { | 327 | } else { |
328 | for (i = 0; i < 2; ++i) { | 328 | for (i = 0; i < 2; ++i) { |
329 | reg = STAC946X_MIC_L_VOLUME + i; | 329 | reg = STAC946X_MIC_L_VOLUME + i; |
330 | nvol = ucontrol->value.integer.value[i]; | 330 | nvol = ucontrol->value.integer.value[i] & 0x0f; |
331 | ovol = 0x0f - stac9460_2_get(ice, reg); | 331 | ovol = 0x0f - stac9460_2_get(ice, reg); |
332 | change = ((ovol & 0x0f) != nvol); | 332 | change = ((ovol & 0x0f) != nvol); |
333 | if (change) | 333 | if (change) |