[PATCH v3 10/12] ASoC: mediatek: mt8189: Validate sysclk frequency
From: phucduc . bui
Date: Wed Sep 16 2026 - 01:03:42 EST
From: bui duc phuc <phucduc.bui@xxxxxxxxx>
A zero frequency causes a modulo-by-zero error when validating the
I2S clock frequency. Reject it before performing the validation.
Fixes: 7eb153585598 ("ASoC: mediatek: mt8189: add platform driver")
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@xxxxxxxxxxxxx>
Signed-off-by: bui duc phuc <phucduc.bui@xxxxxxxxx>
---
Changes in v2:
- Check for zero frequency since freq is unsigned.
Changes in v3:
- Add Angelo's Reviewed-by tag.
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 8cd5ddf62d46..c9e80ef42f60 100644
--- a/sound/soc/mediatek/mt8189/mt8189-dai-i2s.c
+++ b/sound/soc/mediatek/mt8189/mt8189-dai-i2s.c
@@ -1287,6 +1287,9 @@ static int mtk_dai_i2s_set_sysclk(struct snd_soc_dai *dai,
dir != SND_SOC_CLOCK_OUT)
return -EINVAL;
+ if (!freq)
+ return -EINVAL;
+
i2s_priv = afe_priv->dai_priv[dai->id];
if (!i2s_priv)
return -EINVAL;
--
2.43.0