Skip to content

Commit

Permalink
ASoC: Keep index within stac9766_reg[]
Browse files Browse the repository at this point in the history
Keep index within stac9766_reg[]

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
  • Loading branch information
Roel Kluin authored and Mark Brown committed Jul 13, 2009
1 parent cc369cf commit 33e319f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sound/soc/codecs/stac9766.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ static int stac9766_ac97_write(struct snd_soc_codec *codec, unsigned int reg,
stac9766_ac97_write(codec, AC97_INT_PAGING, 1);
return 0;
}
if (reg / 2 > ARRAY_SIZE(stac9766_reg))
if (reg / 2 >= ARRAY_SIZE(stac9766_reg))
return -EIO;

soc_ac97_ops.write(codec->ac97, reg, val);
Expand All @@ -168,7 +168,7 @@ static unsigned int stac9766_ac97_read(struct snd_soc_codec *codec,
stac9766_ac97_write(codec, AC97_INT_PAGING, 1);
return val;
}
if (reg / 2 > ARRAY_SIZE(stac9766_reg))
if (reg / 2 >= ARRAY_SIZE(stac9766_reg))
return -EIO;

if (reg == AC97_RESET || reg == AC97_GPIO_STATUS ||
Expand Down

0 comments on commit 33e319f

Please sign in to comment.