regulator: fix calculation of voltage range in da9034_set_ldo12_voltage()
authorRoel Kluin <roel.kluin@gmail.com>
Fri, 18 Sep 2009 19:56:20 +0000 (12:56 -0700)
committerLiam Girdwood <lrg@slimlogic.co.uk>
Tue, 22 Sep 2009 12:32:44 +0000 (13:32 +0100)
For val to be greater than 7 or less than 20 is logically always true.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Cc: Liam Girdwood <lrg@slimlogic.co.uk>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
drivers/regulator/da903x.c

index 7d9c250..c9de730 100644 (file)
@@ -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;