[PATCH] ASoC: mediatek: mt8188: Add error handling in mtk_dai_etdm_enable_mclk

Zhu Jun posted 1 patch 1 year, 2 months ago
sound/soc/mediatek/mt8188/mt8188-dai-etdm.c | 2 ++
1 file changed, 2 insertions(+)
[PATCH] ASoC: mediatek: mt8188: Add error handling in mtk_dai_etdm_enable_mclk
Posted by Zhu Jun 1 year, 2 months ago
Introduce error handling in mtk_dai_etdm_enable_mclk to ensure that
the function returns immediately if mt8188_afe_set_clk_rate fails.

Signed-off-by: Zhu Jun <zhujun2@cmss.chinamobile.com>
---
 sound/soc/mediatek/mt8188/mt8188-dai-etdm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sound/soc/mediatek/mt8188/mt8188-dai-etdm.c b/sound/soc/mediatek/mt8188/mt8188-dai-etdm.c
index 69a091dad..bd325dc71 100644
--- a/sound/soc/mediatek/mt8188/mt8188-dai-etdm.c
+++ b/sound/soc/mediatek/mt8188/mt8188-dai-etdm.c
@@ -430,6 +430,8 @@ static int mtk_dai_etdm_enable_mclk(struct mtk_base_afe *afe, int dai_id)
 	/* set rate */
 	ret = mt8188_afe_set_clk_rate(afe, afe_priv->clk[clkdiv_id],
 				      etdm_data->mclk_freq);
+	if (ret)
+		return ret;
 
 	mt8188_afe_enable_clk(afe, afe_priv->clk[clkdiv_id]);
 
-- 
2.17.1
Re: [PATCH] ASoC: mediatek: mt8188: Add error handling in mtk_dai_etdm_enable_mclk
Posted by Markus Elfring 1 year, 2 months ago
> Introduce error handling in mtk_dai_etdm_enable_mclk to ensure that
> the function returns immediately if mt8188_afe_set_clk_rate fails.

* I suggest to append parentheses to function names.

* How do you think about to add any tags (like “Fixes” and “Cc”) accordingly?
  https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.12#n145


Regards,
Markus