aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/ac97
diff options
context:
space:
mode:
authorJames C Georgas <jgeorgas@rogers.com>2006-12-07 02:10:57 -0500
committerJaroslav Kysela <perex@server.perex.cz>2006-12-20 02:56:10 -0500
commite8bb036a46ec4a9d748672f54a6b2d62c82b6fbd (patch)
tree27fef55b23f193e1591c7fb67ec3918d0b71e067 /sound/pci/ac97
parentd5f6a38d9896614e2e78a82c6cb818721601c52f (diff)
[ALSA] ac97_codec - trivial fix for bit update functions
This patch fixes a couple of bit update functions in alsa-kernel/pci/ac97/ac97_codec.c, which could possibly corrupt bits not in the given mask. Specifically, it'll clobber unset bits in the target that are not in the mask, when the corresponding bit in the given new value is set. Signed-off-by: James C Georgas <jgeorgas@rogers.com> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound/pci/ac97')
-rw-r--r--sound/pci/ac97/ac97_codec.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c
index 7abcb10b2754..91d8ceb4e9c2 100644
--- a/sound/pci/ac97/ac97_codec.c
+++ b/sound/pci/ac97/ac97_codec.c
@@ -382,7 +382,7 @@ int snd_ac97_update_bits_nolock(struct snd_ac97 *ac97, unsigned short reg,
382 unsigned short old, new; 382 unsigned short old, new;
383 383
384 old = snd_ac97_read_cache(ac97, reg); 384 old = snd_ac97_read_cache(ac97, reg);
385 new = (old & ~mask) | value; 385 new = (old & ~mask) | (value & mask);
386 change = old != new; 386 change = old != new;
387 if (change) { 387 if (change) {
388 ac97->regs[reg] = new; 388 ac97->regs[reg] = new;
@@ -399,7 +399,7 @@ static int snd_ac97_ad18xx_update_pcm_bits(struct snd_ac97 *ac97, int codec, uns
399 399
400 mutex_lock(&ac97->page_mutex); 400 mutex_lock(&ac97->page_mutex);
401 old = ac97->spec.ad18xx.pcmreg[codec]; 401 old = ac97->spec.ad18xx.pcmreg[codec];
402 new = (old & ~mask) | value; 402 new = (old & ~mask) | (value & mask);
403 change = old != new; 403 change = old != new;
404 if (change) { 404 if (change) {
405 mutex_lock(&ac97->reg_mutex); 405 mutex_lock(&ac97->reg_mutex);