ASoC: cs35l36: Handle zero sysclk frequency
Subsystems (4)
PATCH 1/1 ASoC: cs35l36: Handle zero sysclk frequency
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.
--- sound/soc/codecs/cs35l36.c | 3 +++ 1 file changed, 3 insertions(+)
sound/soc/codecs/cs35l36.c +3 -0
@@ -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 ;
Signature · 1 line
2.56.0
Quoted 10 lines · Alex Kazinsky
simple_util_shutdown()callssnd_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 toDIV_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.
Quoted 7 lines
Found by Linux Verification Center (linuxtesting.org) with SVACE static analysis tool.
Fixes 6ba9dd6c893b ("ASoC: cs35l36: Add support for Cirrus CS35L36 Amplifier")Signed-off-by Alex Kazinsky <[email protected]>---
Thanks,
Charles
Mark Brown
maintainerQuoted 1 line · Alex Kazinsky
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