[PATCH 13/21] ASoC: max98090: Move mclk acquisition to the i2c probe
From: Chancel Liu
Date: Mon Sep 21 2026 - 07:25:12 EST
From: Chancel Liu <chancel.liu@xxxxxxx>
component->dev is the underlying i2c device whose devres is only
released on physical device removal, not on ASoC card unbind. Getting
the codec clock with devm_clk_get(component->dev, ...) in the component
probe therefore leaks a clk reference on every card bind/unbind cycle.
Move the devm_clk_get() to max98090_i2c_probe() so the clk reference is
tied to the physical device lifetime.
Signed-off-by: Chancel Liu <chancel.liu@xxxxxxx>
---
sound/soc/codecs/max98090.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c
index c31f3d32fa43..4bb5478f4642 100644
--- a/sound/soc/codecs/max98090.c
+++ b/sound/soc/codecs/max98090.c
@@ -2448,11 +2448,6 @@ static int max98090_probe(struct snd_soc_component *component)
dev_dbg(component->dev, "max98090_probe\n");
- max98090->mclk = devm_clk_get(component->dev, "mclk");
- if (IS_ERR(max98090->mclk))
- if (PTR_ERR(max98090->mclk) == -EPROBE_DEFER)
- return -EPROBE_DEFER;
-
max98090->component = component;
/* Reset the codec, the DSP core, and disable all interrupts */
@@ -2633,6 +2628,11 @@ static int max98090_i2c_probe(struct i2c_client *i2c)
goto err_enable;
}
+ max98090->mclk = devm_clk_get(&i2c->dev, "mclk");
+ if (IS_ERR(max98090->mclk))
+ if (PTR_ERR(max98090->mclk) == -EPROBE_DEFER)
+ return -EPROBE_DEFER;
+
ret = devm_request_threaded_irq(&i2c->dev, i2c->irq, NULL,
max98090_interrupt, IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
"max98090_interrupt", max98090);
--
2.50.1