[PATCH v2] ASoC: ES8389: convert to devm_clk_get_optional() to get clock

From: Li Jian

Date: Tue Apr 28 2026 - 02:28:20 EST


Per Documentation/devicetree/bindings/sound/everest,es8389.yaml,
this driver does not require `mclk', so the DT node may lack this
property (even the example lacks the `mclk' property). Therefore,
the driver code should handle this situation by using
`devm_clk_get_optional()'.

Indeed there is already null checking based on CONFIG_HAVE_CLK,
but the driver will not finish initialization, as previously
devm_clk_get() would just return an error pointer. Address this
by introducing a simple conversion to use `devm_clk_get_optional()'.

Cc: stable@xxxxxxxxxxxxxxx
Fixes: commit 0319c26889f7 ("ASoC: codecs: add support for ES8389")
Signed-off-by: Li Jian <lazycat-xiao@xxxxxxxxxxx>
---
sound/soc/codecs/es8389.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/es8389.c b/sound/soc/codecs/es8389.c
index 8d418cae371a..449d9574b03a 100644
--- a/sound/soc/codecs/es8389.c
+++ b/sound/soc/codecs/es8389.c
@@ -892,7 +892,7 @@ static int es8389_probe(struct snd_soc_component *component)
return ret;
}

- es8389->mclk = devm_clk_get(component->dev, "mclk");
+ es8389->mclk = devm_clk_get_optional(component->dev, "mclk");
if (IS_ERR(es8389->mclk))
return dev_err_probe(component->dev, PTR_ERR(es8389->mclk),
"ES8389 is unable to get mclk\n");
--
2.47.3