Messages in this thread Patch in this message | | | Subject | [PATCH] regulator: Fix the logic to ensure new voltage setting in valid range | From | Axel Lin <> | Date | Wed, 11 Apr 2012 20:53:58 +0800 |
| |
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> --- 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 db09244..77feeeb 100644 --- a/drivers/regulator/max8997.c +++ b/drivers/regulator/max8997.c @@ -682,7 +682,7 @@ static int max8997_set_voltage_buck(struct regulator_dev *rdev, } new_val++; - } while (desc->min + desc->step + new_val <= desc->max); + } while (desc->min + desc->step * new_val <= desc->max); new_idx = tmp_idx; new_val = tmp_val; -- 1.7.5.4
| |