aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator
diff options
context:
space:
mode:
authorRoel Kluin <roel.kluin@gmail.com>2009-10-26 12:37:11 +0100
committerLiam Girdwood <lrg@slimlogic.co.uk>2009-12-17 10:27:25 +0000
commit495353a3f7fbb11e5100c9258365ff65a4834b37 (patch)
tree766596871bc81b4871d169771e1e7f185061667b /drivers/regulator
parentregulator: Ensure val is initialised in 88pm8607 choose_voltage() (diff)
downloadlinux-dev-495353a3f7fbb11e5100c9258365ff65a4834b37.tar.xz
linux-dev-495353a3f7fbb11e5100c9258365ff65a4834b37.zip
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>
Diffstat (limited to 'drivers/regulator')
-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 aa224d936e0d..f8c4661a7a81 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;
}