[PATCH] ASoC: cs35l36: Handle zero sysclk frequency
From: Alex Kazinsky
Date: Fri Oct 30 2026 - 10:29:10 EST
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>
---
sound/soc/codecs/cs35l36.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/sound/soc/codecs/cs35l36.c b/sound/soc/codecs/cs35l36.c
index 5fc8ec292e3c..266b95397873 100644
--- a/sound/soc/codecs/cs35l36.c
+++ b/sound/soc/codecs/cs35l36.c
@@ -910,6 +910,9 @@ static int cs35l36_dai_set_sysclk(struct snd_soc_dai *dai, int clk_id,
snd_soc_component_get_drvdata(component);
int fs1, fs2;
+ if (!freq)
+ return 0;
+
if (freq > CS35L36_FS_NOM_6MHZ) {
fs1 = CS35L36_FS1_DEFAULT_VAL;
fs2 = CS35L36_FS2_DEFAULT_VAL;
--
2.56.0