* [PATCH] regulator: rt6190: Fix runtime PM imbalance in rt6190_out_enable()
@ 2026-09-16 7:25 Wentao Liang
2026-09-16 8:46 ` ChiYuan Huang
2026-09-18 17:53 ` Mark Brown
0 siblings, 2 replies; 3+ messages in thread
From: Wentao Liang @ 2026-09-16 7:25 UTC (permalink / raw)
To: broonie; +Cc: cy_huang, lgirdwood, linux-kernel, Wentao Liang, stable
In rt6190_out_enable(), pm_runtime_get_sync() is called at the start of
the function. However, if any subsequent regmap or regulator operation
fails, the function returns directly without dropping the runtime PM
reference, causing a runtime PM reference leak.
Add an error handling path with pm_runtime_put() to keep the reference
count balanced on failure.
Fixes: e6999e7cca7e ("regulator: rt6190: Add support for Richtek RT6190 regulator")
Cc: stable@vger.kernel.org
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
drivers/regulator/rt6190-regulator.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/drivers/regulator/rt6190-regulator.c b/drivers/regulator/rt6190-regulator.c
index 3883440295ed..bf99e18f6d5b 100644
--- a/drivers/regulator/rt6190-regulator.c
+++ b/drivers/regulator/rt6190-regulator.c
@@ -109,19 +109,27 @@ static int rt6190_out_enable(struct regulator_dev *rdev)
ret = regmap_raw_read(regmap, RT6190_REG_OUTV, out_cfg,
sizeof(out_cfg));
if (ret)
- return ret;
+ goto err_pm_put;
ret = regulator_enable_regmap(rdev);
if (ret)
- return ret;
+ goto err_pm_put;
ret = regmap_raw_write(regmap, RT6190_REG_OUTV, out_cfg,
sizeof(out_cfg));
if (ret)
- return ret;
+ goto err_pm_put;
+
+ ret = regmap_update_bits(regmap, RT6190_REG_SET5, RT6190_ENGCP_MASK,
+ RT6190_ENGCP_MASK);
+ if (ret)
+ goto err_pm_put;
+
+ return 0;
- return regmap_update_bits(regmap, RT6190_REG_SET5, RT6190_ENGCP_MASK,
- RT6190_ENGCP_MASK);
+err_pm_put:
+ pm_runtime_put(data->dev);
+ return ret;
}
static int rt6190_out_disable(struct regulator_dev *rdev)
--
2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] regulator: rt6190: Fix runtime PM imbalance in rt6190_out_enable()
2026-09-16 7:25 [PATCH] regulator: rt6190: Fix runtime PM imbalance in rt6190_out_enable() Wentao Liang
@ 2026-09-16 8:46 ` ChiYuan Huang
2026-09-18 17:53 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: ChiYuan Huang @ 2026-09-16 8:46 UTC (permalink / raw)
To: Wentao Liang; +Cc: broonie, lgirdwood, linux-kernel, stable
On Wed, Sep 16, 2026 at 07:25:41AM +0000, Wentao Liang wrote:
> In rt6190_out_enable(), pm_runtime_get_sync() is called at the start of
> the function. However, if any subsequent regmap or regulator operation
> fails, the function returns directly without dropping the runtime PM
> reference, causing a runtime PM reference leak.
>
> Add an error handling path with pm_runtime_put() to keep the reference
> count balanced on failure.
>
> Fixes: e6999e7cca7e ("regulator: rt6190: Add support for Richtek RT6190 regulator")
> Cc: stable@vger.kernel.org
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
Reviewed-by: ChiYuan Huang <cy_huang@richtek.com>
Thanks for the fix.
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] regulator: rt6190: Fix runtime PM imbalance in rt6190_out_enable()
2026-09-16 7:25 [PATCH] regulator: rt6190: Fix runtime PM imbalance in rt6190_out_enable() Wentao Liang
2026-09-16 8:46 ` ChiYuan Huang
@ 2026-09-18 17:53 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2026-09-18 17:53 UTC (permalink / raw)
To: Wentao Liang; +Cc: cy_huang, lgirdwood, linux-kernel, stable
On Wed, 16 Sep 2026 07:25:41 +0000, Wentao Liang wrote:
> regulator: rt6190: Fix runtime PM imbalance in rt6190_out_enable()
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-7.4
Thanks!
[1/1] regulator: rt6190: Fix runtime PM imbalance in rt6190_out_enable()
https://git.kernel.org/broonie/regulator/c/e0d673e5a5c4
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] 3+ messages in thread
end of thread, other threads:[~2026-09-18 21:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-16 7:25 [PATCH] regulator: rt6190: Fix runtime PM imbalance in rt6190_out_enable() Wentao Liang
2026-09-16 8:46 ` ChiYuan Huang
2026-09-18 17:53 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®