Commit 42d66f95 authored by Axel Lin's avatar Axel Lin Committed by Ben Hutchings

regulator: Fix the logic to ensure new voltage setting in valid range

commit f55205f4 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: default avatarAxel Lin <axel.lin@gmail.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent a2cfa874
......@@ -689,7 +689,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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment