aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_codec.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2010-03-29 03:19:38 -0400
committerTakashi Iwai <tiwai@suse.de>2010-03-29 03:20:39 -0400
commit467126460818e287aa92c73232c38453ec2ab013 (patch)
treebc02161edee275b50b8d88e267e1164319a4b609 /sound/pci/hda/hda_codec.c
parent55440e4e37540305997b7e93d319ddce97a9cfb1 (diff)
ALSA: hda - Report errors when invalid values are passed to snd_hda_amp_*()
The values should be in 8 bits. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/hda_codec.c')
-rw-r--r--sound/pci/hda/hda_codec.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index d72bcff8d271..d1424e7b9f3d 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -1461,6 +1461,8 @@ int snd_hda_codec_amp_update(struct hda_codec *codec, hda_nid_t nid, int ch,
1461 info = get_alloc_amp_hash(codec, HDA_HASH_KEY(nid, direction, idx)); 1461 info = get_alloc_amp_hash(codec, HDA_HASH_KEY(nid, direction, idx));
1462 if (!info) 1462 if (!info)
1463 return 0; 1463 return 0;
1464 if (snd_BUG_ON(mask & ~0xff))
1465 mask &= 0xff;
1464 val &= mask; 1466 val &= mask;
1465 val |= get_vol_mute(codec, info, nid, ch, direction, idx) & ~mask; 1467 val |= get_vol_mute(codec, info, nid, ch, direction, idx) & ~mask;
1466 if (info->vol[ch] == val) 1468 if (info->vol[ch] == val)
@@ -1486,6 +1488,9 @@ int snd_hda_codec_amp_stereo(struct hda_codec *codec, hda_nid_t nid,
1486 int direction, int idx, int mask, int val) 1488 int direction, int idx, int mask, int val)
1487{ 1489{
1488 int ch, ret = 0; 1490 int ch, ret = 0;
1491
1492 if (snd_BUG_ON(mask & ~0xff))
1493 mask &= 0xff;
1489 for (ch = 0; ch < 2; ch++) 1494 for (ch = 0; ch < 2; ch++)
1490 ret |= snd_hda_codec_amp_update(codec, nid, ch, direction, 1495 ret |= snd_hda_codec_amp_update(codec, nid, ch, direction,
1491 idx, mask, val); 1496 idx, mask, val);