summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbui duc phuc <phucduc.bui@gmail.com>2026-10-02 11:38:53 +0700
committerMark Brown <broonie@kernel.org>2026-10-13 17:08:07 +0100
commitbe952abd69c1f2c845e42e72147751e4c910cd81 (patch)
tree42f923b8fdbc3e95f407e87c6dd99d1d1b7786ad
parent2e2da92de9bffd2cdbb9a2558fe60de7f1bb09e3 (diff)
ASoC: atmel-i2s: use optional API for muxclk
The muxclk is an optional clock according to the device tree binding. Use devm_clk_get_optional() to handle the optional muxclk instead of handling the missing clock explicitly. When muxclk is not available, devm_clk_get_optional() returns NULL. clk_set_parent() returns 0 when passed NULL, preserving the existing behavior. Unlike the existing code, errors other than -EPROBE_DEFER are now returned instead of being silently ignored. Fixes: b543e467d1a9 ("ASoC: atmel-i2s: add driver for the new Atmel I2S controller") Signed-off-by: bui duc phuc <phucduc.bui@gmail.com> Link: https://patch.msgid.link/20261002043856.97295-3-phucduc.bui@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/atmel/atmel-i2s.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/sound/soc/atmel/atmel-i2s.c b/sound/soc/atmel/atmel-i2s.c
index f28808d980ce..c52d048449f8 100644
--- a/sound/soc/atmel/atmel-i2s.c
+++ b/sound/soc/atmel/atmel-i2s.c
@@ -589,21 +589,15 @@ static int atmel_i2s_sama5d2_mck_init(struct atmel_i2s_dev *dev,
struct device_node *np)
{
struct clk *muxclk;
- int err;
if (!dev->gclk)
return 0;
- /* muxclk is optional, so we return error for probe defer only */
- muxclk = devm_clk_get(dev->dev, "muxclk");
- if (IS_ERR(muxclk)) {
- err = PTR_ERR(muxclk);
- if (err == -EPROBE_DEFER)
- return -EPROBE_DEFER;
- dev_dbg(dev->dev,
- "failed to get the I2S clock control: %d\n", err);
- return 0;
- }
+ /* muxclk is optional */
+ muxclk = devm_clk_get_optional(dev->dev, "muxclk");
+ if (IS_ERR(muxclk))
+ return dev_err_probe(dev->dev, PTR_ERR(muxclk),
+ "failed to get the I2S clock control\n");
return clk_set_parent(muxclk, dev->gclk);
}