* [PATCH] ASoC: cs35l36: Handle zero sysclk frequency
@ 2026-10-30 14:26 Alex Kazinsky
0 siblings, 0 replies; only message in thread
From: Alex Kazinsky @ 2026-10-30 14:26 UTC (permalink / raw)
To: David Rhodes
Cc: Alex Kazinsky, Richard Fitzgerald, Liam Girdwood, Mark Brown,
Jaroslav Kysela, Takashi Iwai, Brian Austin, Charles Keepax,
James Schulman, linux-sound, patches, linux-kernel, lvc-project,
stable
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@vger.kernel.org
Signed-off-by: Alex Kazinsky <a.kazinsky@ideco.ru>
---
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-10-30 14:27 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-30 14:26 [PATCH] ASoC: cs35l36: Handle zero sysclk frequency Alex Kazinsky
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®