All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: ep93xx: ignore 0 Hz sysclk
@ 2023-02-12 22:09 ` Alexander Sverdlin
  0 siblings, 0 replies; 4+ messages in thread
From: Alexander Sverdlin @ 2023-02-12 22:09 UTC (permalink / raw)
  To: alsa-devel
  Cc: Alexander Sverdlin, Liam Girdwood, Mark Brown, Jaroslav Kysela,
	Takashi Iwai, linux-kernel

Commit 2458adb8f92a
("SoC: simple-card-utils: set 0Hz to sysclk when shutdown")
added a call to snd_soc_dai_set_sysclk() with 0 Hz frequency. Being
propagated further it causes a division by zero in clk-ep93xx driver:

Division by zero in kernel.
CPU: 0 PID: 52 Comm: aplay Tainted: G        W          6.2.0-rc4-... #1
Hardware name: Generic DT based system
 unwind_backtrace from show_stack+0x10/0x18
 show_stack from dump_stack_lvl+0x28/0x34
 dump_stack_lvl from __div0+0x10/0x1c
 __div0 from Ldiv0+0x8/0x1c
 Ldiv0 from ep93xx_mux_determine_rate+0x78/0x1d0
 ep93xx_mux_determine_rate from clk_core_round_rate_nolock+0x48/0xc8
 clk_core_round_rate_nolock from clk_core_set_rate_nolock+0x48/0x160
 clk_core_set_rate_nolock from clk_set_rate+0x30/0x8c
 clk_set_rate from ep93xx_i2s_set_sysclk+0x30/0x6c
 ep93xx_i2s_set_sysclk from snd_soc_dai_set_sysclk+0x3c/0xa4
 snd_soc_dai_set_sysclk from asoc_simple_shutdown+0xb8/0x164
 asoc_simple_shutdown from snd_soc_link_shutdown+0x44/0x54
 snd_soc_link_shutdown from soc_pcm_clean+0x78/0x180
 soc_pcm_clean from soc_pcm_close+0x28/0x40
 soc_pcm_close from snd_pcm_release_substream.part.0+0x3c/0x84
 snd_pcm_release_substream.part.0 from snd_pcm_release+0x40/0x88
 snd_pcm_release from __fput+0x74/0x278

There has been commit f1879d7b98dc ("ASoC: rockchip: ignore 0Hz sysclk"),
but it prepared by far not all drivers.

Signed-off-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
---
 sound/soc/cirrus/ep93xx-i2s.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sound/soc/cirrus/ep93xx-i2s.c b/sound/soc/cirrus/ep93xx-i2s.c
index 982151330c89..f41712df7994 100644
--- a/sound/soc/cirrus/ep93xx-i2s.c
+++ b/sound/soc/cirrus/ep93xx-i2s.c
@@ -359,6 +359,8 @@ static int ep93xx_i2s_set_sysclk(struct snd_soc_dai *cpu_dai, int clk_id,
 
 	if (dir == SND_SOC_CLOCK_IN || clk_id != 0)
 		return -EINVAL;
+	if (!freq)
+		return 0;
 
 	return clk_set_rate(info->mclk, freq);
 }
-- 
2.39.1


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

* [PATCH] ASoC: ep93xx: ignore 0 Hz sysclk
@ 2023-02-12 22:09 ` Alexander Sverdlin
  0 siblings, 0 replies; 4+ messages in thread
From: Alexander Sverdlin @ 2023-02-12 22:09 UTC (permalink / raw)
  To: alsa-devel
  Cc: Alexander Sverdlin, Liam Girdwood, Mark Brown, Takashi Iwai,
	linux-kernel

Commit 2458adb8f92a
("SoC: simple-card-utils: set 0Hz to sysclk when shutdown")
added a call to snd_soc_dai_set_sysclk() with 0 Hz frequency. Being
propagated further it causes a division by zero in clk-ep93xx driver:

Division by zero in kernel.
CPU: 0 PID: 52 Comm: aplay Tainted: G        W          6.2.0-rc4-... #1
Hardware name: Generic DT based system
 unwind_backtrace from show_stack+0x10/0x18
 show_stack from dump_stack_lvl+0x28/0x34
 dump_stack_lvl from __div0+0x10/0x1c
 __div0 from Ldiv0+0x8/0x1c
 Ldiv0 from ep93xx_mux_determine_rate+0x78/0x1d0
 ep93xx_mux_determine_rate from clk_core_round_rate_nolock+0x48/0xc8
 clk_core_round_rate_nolock from clk_core_set_rate_nolock+0x48/0x160
 clk_core_set_rate_nolock from clk_set_rate+0x30/0x8c
 clk_set_rate from ep93xx_i2s_set_sysclk+0x30/0x6c
 ep93xx_i2s_set_sysclk from snd_soc_dai_set_sysclk+0x3c/0xa4
 snd_soc_dai_set_sysclk from asoc_simple_shutdown+0xb8/0x164
 asoc_simple_shutdown from snd_soc_link_shutdown+0x44/0x54
 snd_soc_link_shutdown from soc_pcm_clean+0x78/0x180
 soc_pcm_clean from soc_pcm_close+0x28/0x40
 soc_pcm_close from snd_pcm_release_substream.part.0+0x3c/0x84
 snd_pcm_release_substream.part.0 from snd_pcm_release+0x40/0x88
 snd_pcm_release from __fput+0x74/0x278

There has been commit f1879d7b98dc ("ASoC: rockchip: ignore 0Hz sysclk"),
but it prepared by far not all drivers.

Signed-off-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
---
 sound/soc/cirrus/ep93xx-i2s.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sound/soc/cirrus/ep93xx-i2s.c b/sound/soc/cirrus/ep93xx-i2s.c
index 982151330c89..f41712df7994 100644
--- a/sound/soc/cirrus/ep93xx-i2s.c
+++ b/sound/soc/cirrus/ep93xx-i2s.c
@@ -359,6 +359,8 @@ static int ep93xx_i2s_set_sysclk(struct snd_soc_dai *cpu_dai, int clk_id,
 
 	if (dir == SND_SOC_CLOCK_IN || clk_id != 0)
 		return -EINVAL;
+	if (!freq)
+		return 0;
 
 	return clk_set_rate(info->mclk, freq);
 }
-- 
2.39.1


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

* Re: [PATCH] ASoC: ep93xx: ignore 0 Hz sysclk
  2023-02-12 22:09 ` Alexander Sverdlin
@ 2023-02-13 16:18   ` Mark Brown
  -1 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2023-02-13 16:18 UTC (permalink / raw)
  To: alsa-devel, Alexander Sverdlin
  Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, linux-kernel

On Sun, 12 Feb 2023 23:09:23 +0100, Alexander Sverdlin wrote:
> Commit 2458adb8f92a
> ("SoC: simple-card-utils: set 0Hz to sysclk when shutdown")
> added a call to snd_soc_dai_set_sysclk() with 0 Hz frequency. Being
> propagated further it causes a division by zero in clk-ep93xx driver:
> 
> Division by zero in kernel.
> CPU: 0 PID: 52 Comm: aplay Tainted: G        W          6.2.0-rc4-... #1
> Hardware name: Generic DT based system
>  unwind_backtrace from show_stack+0x10/0x18
>  show_stack from dump_stack_lvl+0x28/0x34
>  dump_stack_lvl from __div0+0x10/0x1c
>  __div0 from Ldiv0+0x8/0x1c
>  Ldiv0 from ep93xx_mux_determine_rate+0x78/0x1d0
>  ep93xx_mux_determine_rate from clk_core_round_rate_nolock+0x48/0xc8
>  clk_core_round_rate_nolock from clk_core_set_rate_nolock+0x48/0x160
>  clk_core_set_rate_nolock from clk_set_rate+0x30/0x8c
>  clk_set_rate from ep93xx_i2s_set_sysclk+0x30/0x6c
>  ep93xx_i2s_set_sysclk from snd_soc_dai_set_sysclk+0x3c/0xa4
>  snd_soc_dai_set_sysclk from asoc_simple_shutdown+0xb8/0x164
>  asoc_simple_shutdown from snd_soc_link_shutdown+0x44/0x54
>  snd_soc_link_shutdown from soc_pcm_clean+0x78/0x180
>  soc_pcm_clean from soc_pcm_close+0x28/0x40
>  soc_pcm_close from snd_pcm_release_substream.part.0+0x3c/0x84
>  snd_pcm_release_substream.part.0 from snd_pcm_release+0x40/0x88
>  snd_pcm_release from __fput+0x74/0x278
> 
> [...]

Applied to

   broonie/sound.git for-next

Thanks!

[1/1] ASoC: ep93xx: ignore 0 Hz sysclk
      commit: 66dc3b9b9a6f4b5c7013f15c66073ddd20852b66

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] 4+ messages in thread

* Re: [PATCH] ASoC: ep93xx: ignore 0 Hz sysclk
@ 2023-02-13 16:18   ` Mark Brown
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2023-02-13 16:18 UTC (permalink / raw)
  To: alsa-devel, Alexander Sverdlin; +Cc: Liam Girdwood, Takashi Iwai, linux-kernel

On Sun, 12 Feb 2023 23:09:23 +0100, Alexander Sverdlin wrote:
> Commit 2458adb8f92a
> ("SoC: simple-card-utils: set 0Hz to sysclk when shutdown")
> added a call to snd_soc_dai_set_sysclk() with 0 Hz frequency. Being
> propagated further it causes a division by zero in clk-ep93xx driver:
> 
> Division by zero in kernel.
> CPU: 0 PID: 52 Comm: aplay Tainted: G        W          6.2.0-rc4-... #1
> Hardware name: Generic DT based system
>  unwind_backtrace from show_stack+0x10/0x18
>  show_stack from dump_stack_lvl+0x28/0x34
>  dump_stack_lvl from __div0+0x10/0x1c
>  __div0 from Ldiv0+0x8/0x1c
>  Ldiv0 from ep93xx_mux_determine_rate+0x78/0x1d0
>  ep93xx_mux_determine_rate from clk_core_round_rate_nolock+0x48/0xc8
>  clk_core_round_rate_nolock from clk_core_set_rate_nolock+0x48/0x160
>  clk_core_set_rate_nolock from clk_set_rate+0x30/0x8c
>  clk_set_rate from ep93xx_i2s_set_sysclk+0x30/0x6c
>  ep93xx_i2s_set_sysclk from snd_soc_dai_set_sysclk+0x3c/0xa4
>  snd_soc_dai_set_sysclk from asoc_simple_shutdown+0xb8/0x164
>  asoc_simple_shutdown from snd_soc_link_shutdown+0x44/0x54
>  snd_soc_link_shutdown from soc_pcm_clean+0x78/0x180
>  soc_pcm_clean from soc_pcm_close+0x28/0x40
>  soc_pcm_close from snd_pcm_release_substream.part.0+0x3c/0x84
>  snd_pcm_release_substream.part.0 from snd_pcm_release+0x40/0x88
>  snd_pcm_release from __fput+0x74/0x278
> 
> [...]

Applied to

   broonie/sound.git for-next

Thanks!

[1/1] ASoC: ep93xx: ignore 0 Hz sysclk
      commit: 66dc3b9b9a6f4b5c7013f15c66073ddd20852b66

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] 4+ messages in thread

end of thread, other threads:[~2023-02-13 16:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-12 22:09 [PATCH] ASoC: ep93xx: ignore 0 Hz sysclk Alexander Sverdlin
2023-02-12 22:09 ` Alexander Sverdlin
2023-02-13 16:18 ` Mark Brown
2023-02-13 16:18   ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.