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

Commit 656d0498 authored by Roel Kluin's avatar Roel Kluin Committed by Liam Girdwood
Browse files

regulator: fix calculation of voltage range in da9034_set_ldo12_voltage()



For val to be greater than 7 or less than 20 is logically always true.

Signed-off-by: default avatarRoel Kluin <roel.kluin@gmail.com>
Cc: Liam Girdwood <lrg@slimlogic.co.uk>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Acked-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: default avatarLiam Girdwood <lrg@slimlogic.co.uk>
parent 77bb8ff9
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -301,7 +301,7 @@ static int da9034_set_ldo12_voltage(struct regulator_dev *rdev,
	}

	val = (min_uV - info->min_uV + info->step_uV - 1) / info->step_uV;
	val = (val > 7 || val < 20) ? 8 : val - 12;
	val = (val > 7 && val < 20) ? 8 : val - 12;
	val <<= info->vol_shift;
	mask = ((1 << info->vol_nbits) - 1)  << info->vol_shift;