mirror of
https://github.com/adulau/aha.git
synced 2024-12-27 19:26:25 +00:00
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>
This commit is contained in:
parent
ddec68107a
commit
495353a3f7
1 changed files with 1 additions and 1 deletions
|
@ -331,7 +331,7 @@ static int da9034_get_ldo12_voltage(struct regulator_dev *rdev)
|
||||||
static int da9034_list_ldo12_voltage(struct regulator_dev *rdev,
|
static int da9034_list_ldo12_voltage(struct regulator_dev *rdev,
|
||||||
unsigned selector)
|
unsigned selector)
|
||||||
{
|
{
|
||||||
if (selector > ARRAY_SIZE(da9034_ldo12_data))
|
if (selector >= ARRAY_SIZE(da9034_ldo12_data))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
return da9034_ldo12_data[selector] * 1000;
|
return da9034_ldo12_data[selector] * 1000;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue