[PATCH 1/3] ASoC: atmel: mchp-i2s-mcc: Use devm_clk_get_optional() for gclk
From: phucduc . bui
Date: Mon Nov 16 2026 - 04:24:35 EST
From: bui duc phuc <phucduc.bui@xxxxxxxxx>
The current code is unnecessarily verbose for handling an optional
clock. Use devm_clk_get_optional() to simplify it.
Signed-off-by: bui duc phuc <phucduc.bui@xxxxxxxxx>
---
sound/soc/atmel/mchp-i2s-mcc.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/sound/soc/atmel/mchp-i2s-mcc.c b/sound/soc/atmel/mchp-i2s-mcc.c
index cb0f3e55b05d..9d8043a85782 100644
--- a/sound/soc/atmel/mchp-i2s-mcc.c
+++ b/sound/soc/atmel/mchp-i2s-mcc.c
@@ -1073,14 +1073,10 @@ static int mchp_i2s_mcc_probe(struct platform_device *pdev)
}
/* Get the optional generated clock */
- dev->gclk = devm_clk_get(&pdev->dev, "gclk");
- if (IS_ERR(dev->gclk)) {
- if (PTR_ERR(dev->gclk) == -EPROBE_DEFER)
- return -EPROBE_DEFER;
- dev_warn(&pdev->dev,
- "generated clock not found: %d\n", err);
- dev->gclk = NULL;
- }
+ dev->gclk = devm_clk_get_optional(&pdev->dev, "gclk");
+ if (IS_ERR(dev->gclk))
+ return dev_err_probe(&pdev->dev, PTR_ERR(dev->gclk),
+ "failed to get the generated clock\n");
dev->soc = of_device_get_match_data(&pdev->dev);
err = mchp_i2s_mcc_soc_data_parse(pdev, dev);
--
2.43.0