diff options
author | Roel Kluin <roel.kluin@gmail.com> | 2009-10-26 07:37:11 -0400 |
---|---|---|
committer | Liam Girdwood <lrg@slimlogic.co.uk> | 2009-12-17 05:27:25 -0500 |
commit | 495353a3f7fbb11e5100c9258365ff65a4834b37 (patch) | |
tree | 766596871bc81b4871d169771e1e7f185061667b | |
parent | ddec68107ab101d9ff934811d5598f5c613027f2 (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>
-rw-r--r-- | drivers/regulator/da903x.c | 2 |
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) | |||
331 | static int da9034_list_ldo12_voltage(struct regulator_dev *rdev, | 331 | static int da9034_list_ldo12_voltage(struct regulator_dev *rdev, |
332 | unsigned selector) | 332 | unsigned selector) |
333 | { | 333 | { |
334 | if (selector > ARRAY_SIZE(da9034_ldo12_data)) | 334 | if (selector >= ARRAY_SIZE(da9034_ldo12_data)) |
335 | return -EINVAL; | 335 | return -EINVAL; |
336 | return da9034_ldo12_data[selector] * 1000; | 336 | return da9034_ldo12_data[selector] * 1000; |
337 | } | 337 | } |