From: Mark Brown Date: Fri, 3 Jun 2011 16:09:14 +0000 (+0100) Subject: ASoC: Enforce the mask in snd_soc_update_bits() X-Git-Tag: v3.3-rc1~14^2~993 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=78bf3c9ab69a957dfa58e521ce7fca056c86b980;p=platform%2Fkernel%2Flinux-stable.git ASoC: Enforce the mask in snd_soc_update_bits() Avoids issues if someone does a read followed by restore and doesn't mask out only the bits being updated. Signed-off-by: Mark Brown Acked-by: Liam Girdwood --- diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 13a40fc..c53f5d5 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -2323,7 +2323,7 @@ int snd_soc_update_bits(struct snd_soc_codec *codec, unsigned short reg, return ret; old = ret; - new = (old & ~mask) | value; + new = (old & ~mask) | (value & mask); change = old != new; if (change) { ret = snd_soc_write(codec, reg, new);