Commit 33e319fb authored by Roel Kluin's avatar Roel Kluin Committed by Mark Brown

ASoC: Keep index within stac9766_reg[]

Keep index within stac9766_reg[]
Signed-off-by: default avatarRoel Kluin <roel.kluin@gmail.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent cc369cf5
...@@ -149,7 +149,7 @@ static int stac9766_ac97_write(struct snd_soc_codec *codec, unsigned int reg, ...@@ -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); stac9766_ac97_write(codec, AC97_INT_PAGING, 1);
return 0; return 0;
} }
if (reg / 2 > ARRAY_SIZE(stac9766_reg)) if (reg / 2 >= ARRAY_SIZE(stac9766_reg))
return -EIO; return -EIO;
soc_ac97_ops.write(codec->ac97, reg, val); soc_ac97_ops.write(codec->ac97, reg, val);
...@@ -168,7 +168,7 @@ static unsigned int stac9766_ac97_read(struct snd_soc_codec *codec, ...@@ -168,7 +168,7 @@ static unsigned int stac9766_ac97_read(struct snd_soc_codec *codec,
stac9766_ac97_write(codec, AC97_INT_PAGING, 1); stac9766_ac97_write(codec, AC97_INT_PAGING, 1);
return val; return val;
} }
if (reg / 2 > ARRAY_SIZE(stac9766_reg)) if (reg / 2 >= ARRAY_SIZE(stac9766_reg))
return -EIO; return -EIO;
if (reg == AC97_RESET || reg == AC97_GPIO_STATUS || if (reg == AC97_RESET || reg == AC97_GPIO_STATUS ||
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment