You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
regulator: core: correct convergence check in regulator_set_voltage()
The logic in regulator_set_voltage() which checks for a non-convergence
condition on a stepped regulator is flawed.
regulator_set_voltage() checks if the error in target voltage has increased
or decreased, and returns -EWOULDBLOCK if the error has not decreased
enough. The correct non-convergence condition is:
new_delta - delta > -rdev->constraints->max_uV_step
or equivalently:
delta - new_delta < rdev->constraints->max_uV_step
But the currently used condition is:
new_delta - delta > rdev->constraints->max_uV_step
Which may cause an infinite loop if the voltage error doesn't converge.
Fix this by correcting the convergence condition.
Suggested-by: Jon Hunter <[email protected]>
Fixes: d511206 ("regulator: core: repeat voltage setting request for stepped regulators")
Signed-off-by: Romain Gantois <[email protected]>
Link: https://patch.msgid.link/[email protected]
Tested-by: Jon Hunter <[email protected]>
Reviewed-by: Jon Hunter <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
0 commit comments