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/wm8580.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/wm8580.c')
-rw-r--r-- | sound/soc/codecs/wm8580.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sound/soc/codecs/wm8580.c b/sound/soc/codecs/wm8580.c index 9b75a377453e..3faf0e70ce10 100644 --- a/sound/soc/codecs/wm8580.c +++ b/sound/soc/codecs/wm8580.c | |||
@@ -200,7 +200,7 @@ static inline unsigned int wm8580_read_reg_cache(struct snd_soc_codec *codec, | |||
200 | unsigned int reg) | 200 | unsigned int reg) |
201 | { | 201 | { |
202 | u16 *cache = codec->reg_cache; | 202 | u16 *cache = codec->reg_cache; |
203 | BUG_ON(reg > ARRAY_SIZE(wm8580_reg)); | 203 | BUG_ON(reg >= ARRAY_SIZE(wm8580_reg)); |
204 | return cache[reg]; | 204 | return cache[reg]; |
205 | } | 205 | } |
206 | 206 | ||
@@ -223,7 +223,7 @@ static int wm8580_write(struct snd_soc_codec *codec, unsigned int reg, | |||
223 | { | 223 | { |
224 | u8 data[2]; | 224 | u8 data[2]; |
225 | 225 | ||
226 | BUG_ON(reg > ARRAY_SIZE(wm8580_reg)); | 226 | BUG_ON(reg >= ARRAY_SIZE(wm8580_reg)); |
227 | 227 | ||
228 | /* Registers are 9 bits wide */ | 228 | /* Registers are 9 bits wide */ |
229 | value &= 0x1ff; | 229 | value &= 0x1ff; |