Skip to content

Commit

Permalink
regulator: vctrl: Use locked regulator_get_voltage in probe path
Browse files Browse the repository at this point in the history
[ Upstream commit 98e4757 ]

In commit e915331 ("regulator: vctrl-regulator: Avoid deadlock getting
and setting the voltage"), all calls to get/set the voltage of the
control regulator were switched to unlocked versions to avoid deadlocks.
However, the call in the probe path is done without regulator locks
held. In this case the locked version should be used.

Switch back to the locked regulator_get_voltage() in the probe path to
avoid any mishaps.

Fixes: e915331 ("regulator: vctrl-regulator: Avoid deadlock getting and setting the voltage")
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
Link: https://lore.kernel.org/r/20210825033704.3307263-2-wenst@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
wens authored and gregkh committed Sep 15, 2021
1 parent 80b1a70 commit 8665e30
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/regulator/vctrl-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,8 @@ static int vctrl_probe(struct platform_device *pdev)
if (ret)
return ret;

ctrl_uV = regulator_get_voltage_rdev(vctrl->ctrl_reg->rdev);
/* Use locked consumer API when not in regulator framework */
ctrl_uV = regulator_get_voltage(vctrl->ctrl_reg);
if (ctrl_uV < 0) {
dev_err(&pdev->dev, "failed to get control voltage\n");
return ctrl_uV;
Expand Down

0 comments on commit 8665e30

Please sign in to comment.