From: Roel Kluin Date: Fri, 18 Sep 2009 19:56:20 +0000 (-0700) Subject: regulator: fix calculation of voltage range in da9034_set_ldo12_voltage() X-Git-Tag: v2.6.32-rc1~164^2~6 X-Git-Url: http://ftp.safe.ca/?a=commitdiff_plain;h=656d0498ea14c51cd8ec00081b5e0662acc72614;p=safe%2Fjmp%2Flinux-2.6 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: Roel Kluin Cc: Liam Girdwood Cc: Mark Brown Signed-off-by: Andrew Morton Acked-by: Mark Brown Signed-off-by: Liam Girdwood --- diff --git a/drivers/regulator/da903x.c b/drivers/regulator/da903x.c index 7d9c250..c9de730 100644 --- a/drivers/regulator/da903x.c +++ b/drivers/regulator/da903x.c @@ -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;