diff options
author | Ian Molton <ian@mnementh.co.uk> | 2009-01-17 12:44:23 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2009-01-19 11:23:13 -0500 |
commit | 91432e976ff1323e5dd6f52498969602953c6ee9 (patch) | |
tree | e18da7346b857e384a78ecc3368e5c65652ef1b5 /sound/soc/codecs/wm8990.c | |
parent | 28796eaf806502b9bd86cbacf8edbc14c80c14b0 (diff) |
ASoC: fixes to caching implementations
This patch takes fixes a number of bugs in the caching code used by
several ASoC codec drivers. Mostly off-by-one fixes.
Signed-off-by: Ian Molton <ian@mnementh.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/codecs/wm8990.c')
-rw-r--r-- | sound/soc/codecs/wm8990.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sound/soc/codecs/wm8990.c b/sound/soc/codecs/wm8990.c index 6b2778632d5e..f93c0955ed9d 100644 --- a/sound/soc/codecs/wm8990.c +++ b/sound/soc/codecs/wm8990.c | |||
@@ -116,7 +116,7 @@ static inline unsigned int wm8990_read_reg_cache(struct snd_soc_codec *codec, | |||
116 | unsigned int reg) | 116 | unsigned int reg) |
117 | { | 117 | { |
118 | u16 *cache = codec->reg_cache; | 118 | u16 *cache = codec->reg_cache; |
119 | BUG_ON(reg > (ARRAY_SIZE(wm8990_reg)) - 1); | 119 | BUG_ON(reg >= ARRAY_SIZE(wm8990_reg)); |
120 | return cache[reg]; | 120 | return cache[reg]; |
121 | } | 121 | } |
122 | 122 | ||
@@ -129,7 +129,7 @@ static inline void wm8990_write_reg_cache(struct snd_soc_codec *codec, | |||
129 | u16 *cache = codec->reg_cache; | 129 | u16 *cache = codec->reg_cache; |
130 | 130 | ||
131 | /* Reset register and reserved registers are uncached */ | 131 | /* Reset register and reserved registers are uncached */ |
132 | if (reg == 0 || reg > ARRAY_SIZE(wm8990_reg) - 1) | 132 | if (reg == 0 || reg >= ARRAY_SIZE(wm8990_reg)) |
133 | return; | 133 | return; |
134 | 134 | ||
135 | cache[reg] = value; | 135 | cache[reg] = value; |