[PATCH] ASoC: rt9120: Disable runtime PM on component registration failure

From: Haowen Tu

Date: Fri Nov 13 2026 - 01:33:55 EST


Runtime PM is enabled before registering the ASoC component. If
registration fails, probe returns without disabling runtime PM. The
remove callback is not called for a failed probe, so runtime PM remains
enabled while the managed resources are released. A subsequent probe
also encounters an unbalanced pm_runtime_enable().

Disable runtime PM if component registration fails, before returning the
registration error and allowing the probe resources to be released.

Fixes: 80b949f332e3 ("ASoC: rt9120: Use pm_runtime and regcache to optimize 'pwdnn' logic")
Signed-off-by: Haowen Tu <tuhaowen@xxxxxxxxxxxxx>
---
sound/soc/codecs/rt9120.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/sound/soc/codecs/rt9120.c b/sound/soc/codecs/rt9120.c
index dbf12e270917..5dc34034dd1d 100644
--- a/sound/soc/codecs/rt9120.c
+++ b/sound/soc/codecs/rt9120.c
@@ -588,9 +588,13 @@ static int rt9120_probe(struct i2c_client *i2c)
pm_runtime_mark_last_busy(&i2c->dev);
pm_runtime_enable(&i2c->dev);

- return devm_snd_soc_register_component(&i2c->dev,
- &rt9120_component_driver,
- &rt9120_dai, 1);
+ ret = devm_snd_soc_register_component(&i2c->dev,
+ &rt9120_component_driver,
+ &rt9120_dai, 1);
+ if (ret)
+ pm_runtime_disable(&i2c->dev);
+
+ return ret;
}

static void rt9120_remove(struct i2c_client *i2c)
--
2.50.1