[PATCH 11/13] ASoC: mediatek: mt8189: Validate sysclk frequency
From: phucduc . bui
Date: Thu Sep 10 2026 - 09:05:46 EST
From: bui duc phuc <phucduc.bui@xxxxxxxxx>
mtk_dai_i2s_set_sysclk() accepts zero or negative frequencies.
Reject invalid frequencies before configuring the I2S clock.
Fixes: 7eb153585598 ("ASoC: mediatek: mt8189: add platform driver")
Signed-off-by: bui duc phuc <phucduc.bui@xxxxxxxxx>
---
sound/soc/mediatek/mt8189/mt8189-dai-i2s.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/sound/soc/mediatek/mt8189/mt8189-dai-i2s.c b/sound/soc/mediatek/mt8189/mt8189-dai-i2s.c
index f20dbb410223..ca7d786cdeff 100644
--- a/sound/soc/mediatek/mt8189/mt8189-dai-i2s.c
+++ b/sound/soc/mediatek/mt8189/mt8189-dai-i2s.c
@@ -1286,6 +1286,9 @@ static int mtk_dai_i2s_set_sysclk(struct snd_soc_dai *dai,
dir != SND_SOC_CLOCK_OUT)
return -EINVAL;
+ if (freq <= 0)
+ return -EINVAL;
+
i2s_priv = afe_priv->dai_priv[dai->id];
if (!i2s_priv)
return -EINVAL;
--
2.43.0