diff options
| author | Romain Gantois <[email protected]> | 2025-07-29 09:50:57 +0000 |
|---|---|---|
| committer | Mark Brown <[email protected]> | 2025-07-29 13:56:39 +0000 |
| commit | 10dfd36f078423c51602a9a21ed85e8e6c947a00 (patch) | |
| tree | 1346b67cada79f52b45e279393826175ccd1390a /drivers/fpga/microchip-spi.c | |
| parent | regulator: mt6370: Fix spelling mistake in mt6370_regualtor_register (diff) | |
| download | kernel-10dfd36f078423c51602a9a21ed85e8e6c947a00.tar.gz kernel-10dfd36f078423c51602a9a21ed85e8e6c947a00.zip | |
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: d511206dc7443 ("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]>
Diffstat (limited to 'drivers/fpga/microchip-spi.c')
0 files changed, 0 insertions, 0 deletions
