[PATCH 3/5] ASoC: atmel-i2s: use optional API for gclk
From: phucduc . bui
Date: Fri Oct 02 2026 - 00:40:41 EST
From: bui duc phuc <phucduc.bui@xxxxxxxxx>
The gclk is an optional clock according to the device tree binding.
Use devm_clk_get_optional() to handle the optional gclk directly.
Unlike the existing code, errors other than -EPROBE_DEFER are now
returned instead of being silently ignored.
Fixes: 73ad0df57290 ("ASoC: atmel-i2s: Remove unnecessary audio PLL clock (aclk)")
Signed-off-by: bui duc phuc <phucduc.bui@xxxxxxxxx>
---
sound/soc/atmel/atmel-i2s.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/sound/soc/atmel/atmel-i2s.c b/sound/soc/atmel/atmel-i2s.c
index c52d048449f8..6ca230f8adc8 100644
--- a/sound/soc/atmel/atmel-i2s.c
+++ b/sound/soc/atmel/atmel-i2s.c
@@ -670,13 +670,10 @@ static int atmel_i2s_probe(struct platform_device *pdev)
}
/* Get audio clock to generate the I2S Master Clock (I2S_MCK) */
- dev->gclk = devm_clk_get(&pdev->dev, "gclk");
- if (IS_ERR(dev->gclk)) {
- if (PTR_ERR(dev->gclk) == -EPROBE_DEFER)
- return -EPROBE_DEFER;
- /* Master Mode not supported */
- dev->gclk = NULL;
- }
+ dev->gclk = devm_clk_get_optional(&pdev->dev, "gclk");
+ if (IS_ERR(dev->gclk))
+ return PTR_ERR(dev->gclk);
+
dev->dev = &pdev->dev;
dev->regmap = regmap;
platform_set_drvdata(pdev, dev);
--
2.43.0