[PATCH v2 3/3] ASoC: codecs: lpass-{tx,rx}-macro: check clk_set_rate() return value

From: Ajay Kumar Nandam

Date: Tue Jul 07 2026 - 05:49:18 EST


clk_set_rate() returns 0 on success or a negative errno on failure but
the TX and RX macro probe functions were ignoring it. Check the return
value and bail out of probe on failure.

Suggested-by: Konrad Dybcio <konrad.dybcio@xxxxxxxxxxxxxxxx>
Co-developed-by: Ravi Hothi <ravi.hothi@xxxxxxxxxxxxxxxx>
Signed-off-by: Ravi Hothi <ravi.hothi@xxxxxxxxxxxxxxxx>
Signed-off-by: Ajay Kumar Nandam <ajay.nandam@xxxxxxxxxxxxxxxx>
---
sound/soc/codecs/lpass-rx-macro.c | 9 +++++++--
sound/soc/codecs/lpass-tx-macro.c | 9 +++++++--
2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/sound/soc/codecs/lpass-rx-macro.c b/sound/soc/codecs/lpass-rx-macro.c
index 927f75050c0f..388cebf461a3 100644
--- a/sound/soc/codecs/lpass-rx-macro.c
+++ b/sound/soc/codecs/lpass-rx-macro.c
@@ -3863,8 +3863,13 @@ static int rx_macro_probe(struct platform_device *pdev)
rx->dev = dev;

/* set MCLK and NPL rates */
- clk_set_rate(rx->mclk, MCLK_FREQ);
- clk_set_rate(rx->npl, MCLK_FREQ);
+ ret = clk_set_rate(rx->mclk, MCLK_FREQ);
+ if (ret)
+ return ret;
+
+ ret = clk_set_rate(rx->npl, MCLK_FREQ);
+ if (ret)
+ return ret;

ret = devm_pm_clk_create(dev);
if (ret)
diff --git a/sound/soc/codecs/lpass-tx-macro.c b/sound/soc/codecs/lpass-tx-macro.c
index fc073a556fb5..b56605639a24 100644
--- a/sound/soc/codecs/lpass-tx-macro.c
+++ b/sound/soc/codecs/lpass-tx-macro.c
@@ -2319,8 +2319,13 @@ static int tx_macro_probe(struct platform_device *pdev)
tx->active_decimator[TX_MACRO_AIF3_CAP] = -1;

/* set MCLK and NPL rates */
- clk_set_rate(tx->mclk, MCLK_FREQ);
- clk_set_rate(tx->npl, MCLK_FREQ);
+ ret = clk_set_rate(tx->mclk, MCLK_FREQ);
+ if (ret)
+ goto err;
+
+ ret = clk_set_rate(tx->npl, MCLK_FREQ);
+ if (ret)
+ goto err;

ret = devm_pm_clk_create(dev);
if (ret)

--
2.34.1