regulator: Fix the logic to ensure new voltage setting in valid range
PATCH 1/1 regulator: Fix the logic to ensure new voltage setting in valid range
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 <[email protected]>
--- drivers/regulator/max8997.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/regulator/max8997.c +1 -1
@@ -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;
Signature · 1 line
1.7.5.4
Mark Brown
AppliedQuoted 3 lines · Axel Lin
I think this is a typo.
To ensure new voltage setting won't greater thandesc->max, the equation should bedesc->min+desc->step*new_val<=desc->max.
Applied, thanks.