ASoC: Enforce the mask in snd_soc_update_bits()
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Fri, 3 Jun 2011 16:09:14 +0000 (17:09 +0100)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Mon, 6 Jun 2011 11:48:42 +0000 (12:48 +0100)
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 <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
sound/soc/soc-core.c

index 13a40fc78d32ae7b21817a91f72f99dbf5ba443e..c53f5d5895915b7647479379988f7062730a1ad9 100644 (file)
@@ -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);