From: Roel Kluin <roel.kluin@gmail.com>
Date: Mon, 13 Jul 2009 00:20:10 +0000 (+0200)
Subject: ASoC: Keep index within stac9766_reg[]
X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=33e319fba727708ee45fec70091c498da4e8f606;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.git

ASoC: Keep index within stac9766_reg[]

Keep index within stac9766_reg[]

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---

diff --git a/sound/soc/codecs/stac9766.c b/sound/soc/codecs/stac9766.c
index 8ad4b7b3e3b..befc6488c39 100644
--- a/sound/soc/codecs/stac9766.c
+++ b/sound/soc/codecs/stac9766.c
@@ -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);
@@ -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 ||