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>
This commit is contained in:
@@ -452,7 +452,7 @@ static unsigned int ac97_read(struct snd_soc_codec *codec,
|
||||
else {
|
||||
reg = reg >> 1;
|
||||
|
||||
if (reg > (ARRAY_SIZE(wm9712_reg)))
|
||||
if (reg >= (ARRAY_SIZE(wm9712_reg)))
|
||||
return -EIO;
|
||||
|
||||
return cache[reg];
|
||||
@@ -466,7 +466,7 @@ static int ac97_write(struct snd_soc_codec *codec, unsigned int reg,
|
||||
|
||||
soc_ac97_ops.write(codec->ac97, reg, val);
|
||||
reg = reg >> 1;
|
||||
if (reg <= (ARRAY_SIZE(wm9712_reg)))
|
||||
if (reg < (ARRAY_SIZE(wm9712_reg)))
|
||||
cache[reg] = val;
|
||||
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user