mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] ASoC: img: Fix double clock disable on probe failure
@ 2026-10-27 10:44 phucduc.bui
  2026-10-27 10:44 ` [PATCH 1/2] ASoC: img: img-i2s-out: " phucduc.bui
  2026-10-27 10:44 ` [PATCH 2/2] ASoC: img: img-spdif-out: " phucduc.bui
  0 siblings, 2 replies; 3+ messages in thread
From: phucduc.bui @ 2026-10-27 10:44 UTC (permalink / raw)
  To: Mark Brown
  Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Kuninori Morimoto,
	linux-sound, linux-kernel, bui duc phuc

From: bui duc phuc <phucduc.bui@gmail.com>

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(+)

-- 
2.43.0


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

* [PATCH 1/2] ASoC: img: img-i2s-out: Fix double clock disable on probe failure
  2026-10-27 10:44 [PATCH 0/2] ASoC: img: Fix double clock disable on probe failure phucduc.bui
@ 2026-10-27 10:44 ` phucduc.bui
  2026-10-27 10:44 ` [PATCH 2/2] ASoC: img: img-spdif-out: " phucduc.bui
  1 sibling, 0 replies; 3+ messages in thread
From: phucduc.bui @ 2026-10-27 10:44 UTC (permalink / raw)
  To: Mark Brown
  Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Kuninori Morimoto,
	linux-sound, linux-kernel, bui duc phuc

From: bui duc phuc <phucduc.bui@gmail.com>

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.

Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
 sound/soc/img/img-i2s-out.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sound/soc/img/img-i2s-out.c b/sound/soc/img/img-i2s-out.c
index caa7870dbec6..2aa8182d561d 100644
--- a/sound/soc/img/img-i2s-out.c
+++ b/sound/soc/img/img-i2s-out.c
@@ -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);
 
-- 
2.43.0


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

* [PATCH 2/2] ASoC: img: img-spdif-out: Fix double clock disable on probe failure
  2026-10-27 10:44 [PATCH 0/2] ASoC: img: Fix double clock disable on probe failure phucduc.bui
  2026-10-27 10:44 ` [PATCH 1/2] ASoC: img: img-i2s-out: " phucduc.bui
@ 2026-10-27 10:44 ` phucduc.bui
  1 sibling, 0 replies; 3+ messages in thread
From: phucduc.bui @ 2026-10-27 10:44 UTC (permalink / raw)
  To: Mark Brown
  Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Kuninori Morimoto,
	linux-sound, linux-kernel, bui duc phuc

From: bui duc phuc <phucduc.bui@gmail.com>

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.

Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
 sound/soc/img/img-spdif-out.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sound/soc/img/img-spdif-out.c b/sound/soc/img/img-spdif-out.c
index 39a37e4830d8..d93b3a135d79 100644
--- a/sound/soc/img/img-spdif-out.c
+++ b/sound/soc/img/img-spdif-out.c
@@ -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);
 
-- 
2.43.0


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

end of thread, other threads:[~2026-10-27 10:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-27 10:44 [PATCH 0/2] ASoC: img: Fix double clock disable on probe failure phucduc.bui
2026-10-27 10:44 ` [PATCH 1/2] ASoC: img: img-i2s-out: " phucduc.bui
2026-10-27 10:44 ` [PATCH 2/2] ASoC: img: img-spdif-out: " phucduc.bui

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®