[PATCH 3/5] ASoC: kirkwood: kirkwood-i2s: Check return value of clk_prepare_enable()
From: phucduc . bui
Date: Mon Oct 26 2026 - 07:06:22 EST
From: bui duc phuc <phucduc.bui@xxxxxxxxx>
kirkwood_i2s_dev_probe() ignores the return value of
clk_prepare_enable() when enabling the external clock.
If enabling the clock fails, the driver still selects the external
clock DAI configuration and may later call clk_disable_unprepare()
on a clock that was never successfully enabled, triggering an
unbalanced disable warning.
Check the return value and fail probe if enabling the clock fails.
Signed-off-by: bui duc phuc <phucduc.bui@xxxxxxxxx>
---
sound/soc/kirkwood/kirkwood-i2s.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/sound/soc/kirkwood/kirkwood-i2s.c b/sound/soc/kirkwood/kirkwood-i2s.c
index 29641bd4cc60..395790682355 100644
--- a/sound/soc/kirkwood/kirkwood-i2s.c
+++ b/sound/soc/kirkwood/kirkwood-i2s.c
@@ -701,7 +701,9 @@ static int kirkwood_i2s_dev_probe(struct platform_device *pdev)
priv->extclk = ERR_PTR(-EINVAL);
} else {
dev_info(&pdev->dev, "found external clock\n");
- clk_prepare_enable(priv->extclk);
+ err = clk_prepare_enable(priv->extclk);
+ if (err < 0)
+ return err;
soc_dai = kirkwood_i2s_dai_extclk;
}
}
--
2.43.0