The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH 0/2] ASoC: img: Fix clock leaks on probe failure
@ 2026-10-28 10:42 phucduc.bui
  2026-10-28 10:42 ` [PATCH 1/2] ASoC: img: img-i2s-in: Fix clock leak " phucduc.bui
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: phucduc.bui @ 2026-10-28 10:42 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 clock leaks in the IMG I2S input and 
SPDIF input drivers when probe fails.

Compile-tested only.

Best regards,
Phuc

bui duc phuc (2):
  ASoC: img: img-i2s-in: Fix clock leak on probe failure
  ASoC: img: img-spdif-in: Fix clock leak on probe failure

 sound/soc/img/img-i2s-in.c   |  8 ++++++--
 sound/soc/img/img-spdif-in.c | 11 +++++++----
 2 files changed, 13 insertions(+), 6 deletions(-)

-- 
2.43.0


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

* [PATCH 1/2] ASoC: img: img-i2s-in: Fix clock leak on probe failure
  2026-10-28 10:42 [PATCH 0/2] ASoC: img: Fix clock leaks on probe failure phucduc.bui
@ 2026-10-28 10:42 ` phucduc.bui
  2026-10-28 10:42 ` [PATCH 2/2] ASoC: img: img-spdif-in: " phucduc.bui
  2026-11-02  0:17 ` [PATCH 0/2] ASoC: img: Fix clock leaks " Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: phucduc.bui @ 2026-10-28 10:42 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>

The error path of img_i2s_in_probe() only suspends the device by hand
when runtime PM is not enabled, and otherwise relies on the
asynchronous suspend request queued by pm_runtime_put(). The
pm_runtime_disable() call that follows cancels that request if it is
still pending, leaving the sys clock enabled. This happens in particular
when the reset control lookup returns -EPROBE_DEFER.

Disable runtime PM first and then suspend the device by hand if it is
not suspended, as img_i2s_in_dev_remove() does. On the -EPROBE_DEFER
path, use pm_runtime_put_noidle() instead of pm_runtime_put(), as there
is no point in queuing a suspend request that gets cancelled right away.

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

diff --git a/sound/soc/img/img-i2s-in.c b/sound/soc/img/img-i2s-in.c
index a0c87e2a9b30..0c136dca186c 100644
--- a/sound/soc/img/img-i2s-in.c
+++ b/sound/soc/img/img-i2s-in.c
@@ -490,7 +490,7 @@ static int img_i2s_in_probe(struct platform_device *pdev)
 	if (IS_ERR(rst)) {
 		if (PTR_ERR(rst) == -EPROBE_DEFER) {
 			ret = -EPROBE_DEFER;
-			pm_runtime_put(&pdev->dev);
+			pm_runtime_put_noidle(&pdev->dev);
 			goto err_suspend;
 		}
 
@@ -534,8 +534,12 @@ static int img_i2s_in_probe(struct platform_device *pdev)
 	return 0;
 
 err_suspend:
-	if (!pm_runtime_enabled(&pdev->dev))
+	pm_runtime_disable(&pdev->dev);
+	if (!pm_runtime_status_suspended(&pdev->dev))
 		img_i2s_in_runtime_suspend(&pdev->dev);
+
+	return ret;
+
 err_pm_disable:
 	pm_runtime_disable(&pdev->dev);
 
-- 
2.43.0


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

* [PATCH 2/2] ASoC: img: img-spdif-in: Fix clock leak on probe failure
  2026-10-28 10:42 [PATCH 0/2] ASoC: img: Fix clock leaks on probe failure phucduc.bui
  2026-10-28 10:42 ` [PATCH 1/2] ASoC: img: img-i2s-in: Fix clock leak " phucduc.bui
@ 2026-10-28 10:42 ` phucduc.bui
  2026-11-02  0:17 ` [PATCH 0/2] ASoC: img: Fix clock leaks " Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: phucduc.bui @ 2026-10-28 10:42 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>

The error path of img_spdif_in_probe() only suspends the device by hand
when runtime PM is not enabled, and otherwise relies on the asynchronous
suspend request queued by pm_runtime_put(). The pm_runtime_disable()
call that follows cancels that request if it is still pending, leaving
the sys clock enabled. This happens in particular when the reset
control lookup returns -EPROBE_DEFER.

Disable runtime PM first and then suspend the device by hand if it is
not suspended, as img_spdif_in_dev_remove() does. On the -EPROBE_DEFER
path, call pm_runtime_put_noidle() directly and drop the err_pm_put
label, as there is no point in queuing a suspend request that gets
cancelled right away.

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

diff --git a/sound/soc/img/img-spdif-in.c b/sound/soc/img/img-spdif-in.c
index b630644f20cc..d60eb1da4ecd 100644
--- a/sound/soc/img/img-spdif-in.c
+++ b/sound/soc/img/img-spdif-in.c
@@ -722,7 +722,8 @@ static int img_spdif_in_probe(struct platform_device *pdev)
 	if (IS_ERR(rst)) {
 		if (PTR_ERR(rst) == -EPROBE_DEFER) {
 			ret = -EPROBE_DEFER;
-			goto err_pm_put;
+			pm_runtime_put_noidle(&pdev->dev);
+			goto err_suspend;
 		}
 		dev_dbg(dev, "No top level reset found\n");
 		img_spdif_in_writel(spdif, IMG_SPDIF_IN_SOFT_RESET_MASK,
@@ -763,11 +764,13 @@ static int img_spdif_in_probe(struct platform_device *pdev)
 
 	return 0;
 
-err_pm_put:
-	pm_runtime_put(&pdev->dev);
 err_suspend:
-	if (!pm_runtime_enabled(&pdev->dev))
+	pm_runtime_disable(&pdev->dev);
+	if (!pm_runtime_status_suspended(&pdev->dev))
 		img_spdif_in_runtime_suspend(&pdev->dev);
+
+	return ret;
+
 err_pm_disable:
 	pm_runtime_disable(&pdev->dev);
 
-- 
2.43.0


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

* Re: [PATCH 0/2] ASoC: img: Fix clock leaks on probe failure
  2026-10-28 10:42 [PATCH 0/2] ASoC: img: Fix clock leaks on probe failure phucduc.bui
  2026-10-28 10:42 ` [PATCH 1/2] ASoC: img: img-i2s-in: Fix clock leak " phucduc.bui
  2026-10-28 10:42 ` [PATCH 2/2] ASoC: img: img-spdif-in: " phucduc.bui
@ 2026-11-02  0:17 ` Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2026-11-02  0:17 UTC (permalink / raw)
  To: phucduc.bui
  Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Kuninori Morimoto,
	linux-sound, linux-kernel

On Wed, 28 Oct 2026 17:42:21 +0700, phucduc.bui@gmail.com wrote:
> ASoC: img: Fix clock leaks on probe failure
> 
> From: bui duc phuc <phucduc.bui@gmail.com>
> 
> Hi all,
> 
> These patches fix clock leaks in the IMG I2S input and
> SPDIF input drivers when probe fails.
> 
> [...]

Applied to

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

Thanks!

[1/2] ASoC: img: img-i2s-in: Fix clock leak on probe failure
      https://git.kernel.org/broonie/sound/c/6171024a3593
[2/2] ASoC: img: img-spdif-in: Fix clock leak on probe failure
      https://git.kernel.org/broonie/sound/c/28cb2aa75c34

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:[~2026-11-02 13:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-28 10:42 [PATCH 0/2] ASoC: img: Fix clock leaks on probe failure phucduc.bui
2026-10-28 10:42 ` [PATCH 1/2] ASoC: img: img-i2s-in: Fix clock leak " phucduc.bui
2026-10-28 10:42 ` [PATCH 2/2] ASoC: img: img-spdif-in: " phucduc.bui
2026-11-02  0:17 ` [PATCH 0/2] ASoC: img: Fix clock leaks " Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox