[PATCH] ASoC: codecs: es8375: use devm_clk_get_optional() for mclk

From: Karl Mehltretter

Date: Sat Oct 03 2026 - 15:07:52 EST


es8375_read_device_properities() gets "mclk" with devm_clk_get() and
then tests the result for NULL to print "assuming static mclk". A
missing clock makes devm_clk_get() return -ENOENT, so the probe fails
before that test can match.

The binding does not require clocks, its example has none, and
everest,mclk-src lets the codec run from SCLK instead of MCLK. Use
devm_clk_get_optional(), as es8311, es8316, es8323, es8326 and es8389
do for the same clock.

Found with an experimental clang warning about NULL tests on functions
that return error pointers. Tested only in QEMU with i2c-stub in place
of the codec, not on real hardware.

Fixes: de2b3119f9f7 ("ASoC: codecs: add support for ES8375")
Assisted-by: LLM
Signed-off-by: Karl Mehltretter <kmehltretter@xxxxxxxxx>
---
sound/soc/codecs/es8375.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/es8375.c b/sound/soc/codecs/es8375.c
index e8747bc24433..67bf73d80fb5 100644
--- a/sound/soc/codecs/es8375.c
+++ b/sound/soc/codecs/es8375.c
@@ -661,7 +661,7 @@ static int es8375_read_device_properities(struct device *dev, struct es8375_priv
return ret;
}

- es8375->mclk = devm_clk_get(dev, "mclk");
+ es8375->mclk = devm_clk_get_optional(dev, "mclk");
if (IS_ERR(es8375->mclk))
return dev_err_probe(dev, PTR_ERR(es8375->mclk), "unable to get mclk\n");


base-commit: e767a4ea70a3992c37ed604157d32f0dfbf9b1e3
--
2.53.0