linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] regulator: fixed: Ensure enable_counter is correct if reg_domain_disable fails
@ 2021-05-20 11:18 Axel Lin
  2021-05-20 21:08 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2021-05-20 11:18 UTC (permalink / raw)
  To: Mark Brown; +Cc: Dmitry Baryshkov, Liam Girdwood, linux-kernel, Axel Lin

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

Fixes: bf3a28cf4241 ("regulator: fixed: support using power domain for enable/disable")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/regulator/fixed.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c
index 02ad83153e19..34e255c235d4 100644
--- a/drivers/regulator/fixed.c
+++ b/drivers/regulator/fixed.c
@@ -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)
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] regulator: fixed: Ensure enable_counter is correct if reg_domain_disable fails
  2021-05-20 11:18 [PATCH] regulator: fixed: Ensure enable_counter is correct if reg_domain_disable fails Axel Lin
@ 2021-05-20 21:08 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2021-05-20 21:08 UTC (permalink / raw)
  To: Axel Lin; +Cc: Mark Brown, linux-kernel, Liam Girdwood, Dmitry Baryshkov

On Thu, 20 May 2021 19:18:11 +0800, Axel Lin wrote:
> dev_pm_genpd_set_performance_state() may fail, so had better to check it's
> return value before decreasing priv->enable_counter.

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next

Thanks!

[1/1] regulator: fixed: Ensure enable_counter is correct if reg_domain_disable fails
      commit: 855bfff9d623e7aff6556bfb6831d324dec8d96a

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-05-20 21:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-20 11:18 [PATCH] regulator: fixed: Ensure enable_counter is correct if reg_domain_disable fails Axel Lin
2021-05-20 21:08 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).