aboutsummaryrefslogtreecommitdiff
path: root/drivers/regulator/da903x.c
diff options
context:
space:
mode:
authorRoel Kluin2009-10-26 12:37:11 +0100
committerLiam Girdwood2009-12-17 10:27:25 +0000
commit495353a3f7fbb11e5100c9258365ff65a4834b37 (patch)
tree766596871bc81b4871d169771e1e7f185061667b /drivers/regulator/da903x.c
parentddec68107ab101d9ff934811d5598f5c613027f2 (diff)
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/da903x.c')
-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;
}