[PATCH] ASoC: tlv320aic32x4: Fix missing error check for devm_clk_register()

From: Haotian Zhang
Date: Tue Dec 16 2025 - 21:52:10 EST


aic32x4_register_clocks() ignores the return value of
aic32x4_register_clk(), which returns the result of
devm_clk_register(). This causes the driver to ignore
clock registration errors and return success even if
devm_clk_register() fails.

Check the return value of aic32x4_register_clk() and
return the error code if registration fails. The
aic32x4_probe() has already implemented the check for the
return value of aic32x4_register_clocks().

Fixes: 514b044cba66 ("ASoC: tlv320aic32x4: Model PLL in CCF")
Signed-off-by: Haotian Zhang <vulab@xxxxxxxxxxx>
---
sound/soc/codecs/tlv320aic32x4-clk.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/sound/soc/codecs/tlv320aic32x4-clk.c b/sound/soc/codecs/tlv320aic32x4-clk.c
index 5c0a76a4a106..8f04df2a25d1 100644
--- a/sound/soc/codecs/tlv320aic32x4-clk.c
+++ b/sound/soc/codecs/tlv320aic32x4-clk.c
@@ -479,6 +479,7 @@ static struct clk *aic32x4_register_clk(struct device *dev,
int aic32x4_register_clocks(struct device *dev, const char *mclk_name)
{
int i;
+ struct clk *clk;

/*
* These lines are here to preserve the current functionality of
@@ -492,7 +493,9 @@ int aic32x4_register_clocks(struct device *dev, const char *mclk_name)
(const char *[]) { mclk_name, "bclk", "gpio", "pll" };

for (i = 0; i < ARRAY_SIZE(aic32x4_clkdesc_array); ++i)
- aic32x4_register_clk(dev, &aic32x4_clkdesc_array[i]);
+ clk = aic32x4_register_clk(dev, &aic32x4_clkdesc_array[i]);
+ if (IS_ERR(clk))
+ return PTR_ERR(clk);

return 0;
}
--
2.43.0