Skip to contentSkip to conversation

ASoC: img: Fix double clock disable on probe failure

PATCH In review [email protected] 2 participants 4 messages Oct 27 – Nov 2

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover ASoC: img: Fix double clock disable on probe failure

From: bui duc phuc <[email protected]>

Hi all,

These patches fix double clock disable on probe failure in the IMG I2S and SPDIF output drivers by disabling runtime PM before checking the device's suspended state and manually suspending it.

Compile-tested only.

Best regards,
Phuc

bui duc phuc (2):
ASoC: img: img-i2s-out: Fix double clock disable on probe failure
ASoC: img: img-spdif-out: Fix double clock disable on probe failure

 sound/soc/img/img-i2s-out.c   | 4 ++++
 sound/soc/img/img-spdif-out.c | 4 ++++
 2 files changed, 8 insertions(+)
Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/2 ASoC: img: img-i2s-out: Fix double clock disable on probe failure

From: bui duc phuc <[email protected]>

If registering the component or the PCM fails, the error path of img_i2s_out_probe() checks the runtime PM status and suspends the device by hand before calling pm_runtime_disable(). By then, the asynchronous suspend request queued by pm_runtime_put() may still be pending or running, so the suspend callback can run twice and disable the ref and sys clocks twice.

Disable runtime PM first, as img_i2s_out_dev_remove() does. This cancels the suspend request queued by pm_runtime_put() if it is still pending, or waits for it to finish if it is already running, so the status is stable when checked and the suspend callback runs only once.

---
 sound/soc/img/img-i2s-out.c | 4 ++++
 1 file changed, 4 insertions(+)
sound/soc/img/img-i2s-out.c +4 -0
index caa7870dbec6..2aa8182d561d 100644
@@ -535,8 +535,12 @@ static int img_i2s_out_probe(struct platform_device *pdev)
 	return 0;
 
 err_suspend:
+	pm_runtime_disable(&pdev->dev);
 	if (!pm_runtime_status_suspended(&pdev->dev))
 		img_i2s_out_runtime_suspend(&pdev->dev);
+
+	return ret;
+
 err_pm_disable:
 	pm_runtime_disable(&pdev->dev);
 
Signature · 1 line
2.43.0
#2 lore raw

PATCH 2/2 ASoC: img: img-spdif-out: Fix double clock disable on probe failure

In reply to [email protected]

From: bui duc phuc <[email protected]>

If registering the component or the PCM fails, the error path of img_spdif_out_probe checks the runtime PM status and suspends the device by hand before calling pm_runtime_disable(). By then, the asynchronous suspend request queued by pm_runtime_put() may still be pending or running, so the suspend callback can run twice and disable the ref and sys clocks twice.

Disable runtime PM first, as img_spdif_out_dev_remove does. This cancels the suspend request queued by pm_runtime_put() if it is still pending, or waits for it to finish if it is already running, so the status is stable when checked and the suspend callback runs only once.

---
 sound/soc/img/img-spdif-out.c | 4 ++++
 1 file changed, 4 insertions(+)
sound/soc/img/img-spdif-out.c +4 -0
index 39a37e4830d8..d93b3a135d79 100644
@@ -386,8 +386,12 @@ static int img_spdif_out_probe(struct platform_device *pdev)
 	return 0;
 
 err_suspend:
+	pm_runtime_disable(&pdev->dev);
 	if (!pm_runtime_status_suspended(&pdev->dev))
 		img_spdif_out_runtime_suspend(&pdev->dev);
+
+	return ret;
+
 err_pm_disable:
 	pm_runtime_disable(&pdev->dev);
 
Signature · 1 line
2.43.0
maintainer
#3 lore raw
In reply to [email protected]
Quoted 11 lines · On Tue, 27 Oct 2026 17:44:15 +0700, [email protected] wrote:

ASoC: img: Fix double clock disable on probe failure

From: bui duc phuc <[email protected]>

Hi all,

These patches fix double clock disable on probe failure in the IMG I2S and SPDIF output drivers by disabling runtime PM before checking the device's suspended state and manually suspending it.

[...]

Applied to

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

Thanks!

[1/2] ASoC: img: img-i2s-out: Fix double clock disable on probe failure

      https://git.kernel.org/broonie/sound/c/b57bf0ede3ca
[2/2] ASoC: img: img-spdif-out: Fix double clock disable on probe failure
      https://git.kernel.org/broonie/sound/c/52937c91c844

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