mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ASoC: cs35l36: Handle zero sysclk frequency
@ 2026-10-30 14:26 Alex Kazinsky
  2026-11-02  0:03 ` Mark Brown
  2026-11-02 10:28 ` Charles Keepax
  0 siblings, 2 replies; 3+ messages 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] 3+ messages in thread

* Re: [PATCH] ASoC: cs35l36: Handle zero sysclk frequency
  2026-10-30 14:26 [PATCH] ASoC: cs35l36: Handle zero sysclk frequency Alex Kazinsky
@ 2026-11-02  0:03 ` Mark Brown
  2026-11-02 10:28 ` Charles Keepax
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2026-11-02  0:03 UTC (permalink / raw)
  To: David Rhodes, Alex Kazinsky
  Cc: Richard Fitzgerald, Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
	Brian Austin, Charles Keepax, James Schulman, linux-sound,
	patches, linux-kernel, lvc-project, stable

On Fri, 30 Oct 2026 18:26:36 +0400, Alex Kazinsky wrote:
> ASoC: cs35l36: Handle zero sysclk frequency

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.5

Thanks!

[1/1] ASoC: cs35l36: Handle zero sysclk frequency
      https://git.kernel.org/broonie/sound/c/415f0a7c723f

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ASoC: cs35l36: Handle zero sysclk frequency
  2026-10-30 14:26 [PATCH] ASoC: cs35l36: Handle zero sysclk frequency Alex Kazinsky
  2026-11-02  0:03 ` Mark Brown
@ 2026-11-02 10:28 ` Charles Keepax
  1 sibling, 0 replies; 3+ messages in thread
From: Charles Keepax @ 2026-11-02 10:28 UTC (permalink / raw)
  To: Alex Kazinsky
  Cc: David Rhodes, Richard Fitzgerald, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, Brian Austin, James Schulman,
	linux-sound, patches, linux-kernel, lvc-project, stable

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@vger.kernel.org
> Signed-off-by: Alex Kazinsky <a.kazinsky@ideco.ru>
> ---

Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>

Thanks,
Charles

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-02 12:41 UTC | newest]

Thread overview: 3+ messages (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
2026-11-02  0:03 ` Mark Brown
2026-11-02 10:28 ` Charles Keepax

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®