summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoel Kluin <roel.kluin@gmail.com>2009-10-26 11:37:11 (GMT)
committerLiam Girdwood <lrg@slimlogic.co.uk>2009-12-17 10:27:25 (GMT)
commit495353a3f7fbb11e5100c9258365ff65a4834b37 (patch)
tree766596871bc81b4871d169771e1e7f185061667b
parentddec68107ab101d9ff934811d5598f5c613027f2 (diff)
downloadlinux-fsl-qoriq-495353a3f7fbb11e5100c9258365ff65a4834b37.tar.xz
regulator: keep index within bounds in da9034_get_ldo12_voltage()
If selector equals ARRAY_SIZE(da9034_ldo12_data), that is one too large already. Signed-off-by: Roel Kluin <roel.kluin@gmail.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
-rw-r--r--drivers/regulator/da903x.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/regulator/da903x.c b/drivers/regulator/da903x.c
index aa224d9..f8c4661 100644
--- a/drivers/regulator/da903x.c
+++ b/drivers/regulator/da903x.c
@@ -331,7 +331,7 @@ static int da9034_get_ldo12_voltage(struct regulator_dev *rdev)
static int da9034_list_ldo12_voltage(struct regulator_dev *rdev,
unsigned selector)
{
- if (selector > ARRAY_SIZE(da9034_ldo12_data))
+ if (selector >= ARRAY_SIZE(da9034_ldo12_data))
return -EINVAL;
return da9034_ldo12_data[selector] * 1000;
}