Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 495353a3 authored by Roel Kluin's avatar Roel Kluin Committed by Liam Girdwood
Browse files

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: default avatarRoel Kluin <roel.kluin@gmail.com>
Acked-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: default avatarLiam Girdwood <lrg@slimlogic.co.uk>
parent ddec6810
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;
}