Re: [PATCH] ASoC: cs35l36: Handle zero sysclk frequency

From: Charles Keepax

Date: Mon Nov 02 2026 - 05:32:08 EST


On Fri, Oct 30, 2026 at 06:26:36PM +0400, Alex Kazinsky wrote:
> simple_util_shutdown() calls snd_soc_dai_set_sysclk() with a zero
> frequency when mclk-fs is configured, the clock is not fixed and the
> last active stream on the DAI is closed.
>
> cs35l36_dai_set_sysclk() passes this frequency to DIV_ROUND_UP() when
> calculating the FS monitor windows, resulting in division by zero.
>
> Return success without updating the FS monitor windows when the
> frequency is zero, as there is no running clock to monitor.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE
> static analysis tool.
>
> Fixes: 6ba9dd6c893b ("ASoC: cs35l36: Add support for Cirrus CS35L36 Amplifier")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Alex Kazinsky <a.kazinsky@xxxxxxxx>
> ---

Reviewed-by: Charles Keepax <ckeepax@xxxxxxxxxxxxxxxxxxxxx>

Thanks,
Charles