
From: Claudiu Beznea <claudiu.beznea@microchip.com> mainline inclusion from mainline-v5.11-rc1 commit ab97800e088acf34d0014845ed93605dd5c1ea2a category: bugfix bugzilla: 185694 https://gitee.com/openeuler/kernel/issues/I4DDEL Do not continue if selector has already been located. Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com> Link: https://lore.kernel.org/r/1605290164-11556-1-git-send-email-claudiu.beznea@m... Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Guan Jing <guanjing6@huawei.com> Reviewed-by: Chen Hui <judy.chenhui@huawei.com> Signed-off-by: Chen Jun <chenjun102@huawei.com> --- drivers/regulator/core.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 043b5f63b94a..eead157609e5 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -4058,6 +4058,10 @@ int regulator_set_voltage_time(struct regulator *regulator, for (i = 0; i < rdev->desc->n_voltages; i++) { /* We only look for exact voltage matches here */ + + if (old_sel >= 0 && new_sel >= 0) + break; + voltage = regulator_list_voltage(regulator, i); if (voltage < 0) return -EINVAL; -- 2.20.1