Skip to content

Commit

Permalink
regulator: fixed: Ensure enable_counter is correct if reg_domain_disa…
Browse files Browse the repository at this point in the history
…ble fails

dev_pm_genpd_set_performance_state() may fail, so had better to check it's
return value before decreasing priv->enable_counter.

Fixes: bf3a28c ("regulator: fixed: support using power domain for enable/disable")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Link: https://lore.kernel.org/r/20210520111811.1806293-1-axel.lin@ingics.com
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
AxelLin authored and broonie committed May 20, 2021
1 parent 687c9e3 commit 855bfff
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/regulator/fixed.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,15 @@ static int reg_domain_disable(struct regulator_dev *rdev)
{
struct fixed_voltage_data *priv = rdev_get_drvdata(rdev);
struct device *dev = rdev->dev.parent;
int ret;

ret = dev_pm_genpd_set_performance_state(dev, 0);
if (ret)
return ret;

priv->enable_counter--;

return dev_pm_genpd_set_performance_state(dev, 0);
return 0;
}

static int reg_is_enabled(struct regulator_dev *rdev)
Expand Down

0 comments on commit 855bfff

Please sign in to comment.