未验证 提交 855bfff9 编写于 作者: A Axel Lin 提交者: Mark Brown

regulator: fixed: Ensure enable_counter is correct if reg_domain_disable fails

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

Fixes: bf3a28cf ("regulator: fixed: support using power domain for enable/disable")
Signed-off-by: NAxel Lin <axel.lin@ingics.com>
Link: https://lore.kernel.org/r/20210520111811.1806293-1-axel.lin@ingics.comSigned-off-by: NMark Brown <broonie@kernel.org>
上级 687c9e3b
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册