diff options
author | Axel Lin <axel.lin@gmail.com> | 2012-04-11 08:53:58 -0400 |
---|---|---|
committer | Luis Henriques <luis.henriques@canonical.com> | 2012-05-25 12:24:43 -0400 |
commit | 3edc012b2873dbf951c8ef9788ec379b3b0311cc (patch) | |
tree | 7e81c77bf29f3f91fc7ee42067edd3fca2b1ce4c | |
parent | 974b602be4e0cec127258aecda078e8180173274 (diff) |
regulator: Fix the logic to ensure new voltage setting in valid range
BugLink: http://bugs.launchpad.net/bugs/1002880
commit f55205f4d4a8823a11bb8b37ef2ecbd78fb09463 upstream.
I think this is a typo.
To ensure new voltage setting won't greater than desc->max,
the equation should be desc->min + desc->step * new_val <= desc->max.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
-rw-r--r-- | drivers/regulator/max8997.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/regulator/max8997.c b/drivers/regulator/max8997.c index ad6628ca94f..a8fb668c03a 100644 --- a/drivers/regulator/max8997.c +++ b/drivers/regulator/max8997.c | |||
@@ -688,7 +688,7 @@ static int max8997_set_voltage_buck(struct regulator_dev *rdev, | |||
688 | } | 688 | } |
689 | 689 | ||
690 | new_val++; | 690 | new_val++; |
691 | } while (desc->min + desc->step + new_val <= desc->max); | 691 | } while (desc->min + desc->step * new_val <= desc->max); |
692 | 692 | ||
693 | new_idx = tmp_idx; | 693 | new_idx = tmp_idx; |
694 | new_val = tmp_val; | 694 | new_val = tmp_val; |