[PATCH 11/13] ASoC: mediatek: mt8189: Validate sysclk frequency
Dan Carpenter
error27 at gmail.com
Thu Sep 10 06:26:49 PDT 2026
On Thu, Sep 10, 2026 at 07:57:40PM +0700, phucduc.bui at gmail.com wrote:
> From: bui duc phuc <phucduc.bui at gmail.com>
>
> mtk_dai_i2s_set_sysclk() accepts zero or negative frequencies.
^^^^^^^^^^^^^^^^^^^^
It's unsigned int so it can't be negative.
regards,
dan carpenter
> Reject invalid frequencies before configuring the I2S clock.
>
> Fixes: 7eb153585598 ("ASoC: mediatek: mt8189: add platform driver")
> Signed-off-by: bui duc phuc <phucduc.bui at gmail.com>
> ---
> 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
More information about the Linux-mediatek
mailing list