mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] clk: imx: add missing pm_runtime_dont_use_autosuspend() calls
@ 2026-09-15 10:33 Joshua Crofts
  2026-09-15 10:33 ` [PATCH 1/2] clk: imx: clk-imx8qxp-lpcg: add missing pm_runtime_dont_use_autosuspend() Joshua Crofts
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Joshua Crofts @ 2026-09-15 10:33 UTC (permalink / raw)
  To: Abel Vesa, Peng Fan, Stephen Boyd, Brian Masney, Jerome Brunet,
	Frank Li, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam
  Cc: linux-clk, imx, linux-arm-kernel, linux-kernel

Several drivers in the clk subsystem forget to call dont_use_autosuspend()
on teardown or error, causing potential resource leaks. This series adds
the missing calls.

The offending drivers were found using a semantic patch for Coccinelle
I'm working on [1].

[1] https://lore.kernel.org/all/20260915064327.1377-1-joshua.crofts1@gmail.com/

Joshua Crofts (2):
  clk: imx: clk-imx8qxp-lpcg: add missing
    pm_runtime_dont_use_autosuspend()
  clk: imx: scu: add missing pm_runtime_dont_use_autosuspend() call

 drivers/clk/imx/clk-imx8qxp-lpcg.c | 1 +
 drivers/clk/imx/clk-scu.c          | 2 ++
 2 files changed, 3 insertions(+)

-- 
2.47.3


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

* [PATCH 1/2] clk: imx: clk-imx8qxp-lpcg: add missing pm_runtime_dont_use_autosuspend()
  2026-09-15 10:33 [PATCH 0/2] clk: imx: add missing pm_runtime_dont_use_autosuspend() calls Joshua Crofts
@ 2026-09-15 10:33 ` Joshua Crofts
  2026-09-15 10:33 ` [PATCH 2/2] clk: imx: scu: add missing pm_runtime_dont_use_autosuspend() call Joshua Crofts
  2026-09-16  9:24 ` [PATCH 0/2] clk: imx: add missing pm_runtime_dont_use_autosuspend() calls Johan Hovold
  2 siblings, 0 replies; 7+ messages in thread
From: Joshua Crofts @ 2026-09-15 10:33 UTC (permalink / raw)
  To: Abel Vesa, Peng Fan, Stephen Boyd, Brian Masney, Jerome Brunet,
	Frank Li, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam
  Cc: linux-clk, imx, linux-arm-kernel, linux-kernel, stable

imx_lpcg_parse_clks_from_dt() disables PM runtime but doesn't call the
pm_runtime_dont_use_autosuspend() function, causing potential resource
leaks.

Add the missing function call.

Found using Coccinelle.

Fixes: 18cdbad40c6c ("clk: imx: clk-imx8qxp-lpcg: add runtime pm support")
Cc: <stable@vger.kernel.org>
Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com>
---
 drivers/clk/imx/clk-imx8qxp-lpcg.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/clk/imx/clk-imx8qxp-lpcg.c b/drivers/clk/imx/clk-imx8qxp-lpcg.c
index f0cf6cf91899..b31903060361 100644
--- a/drivers/clk/imx/clk-imx8qxp-lpcg.c
+++ b/drivers/clk/imx/clk-imx8qxp-lpcg.c
@@ -279,6 +279,7 @@ static int imx_lpcg_parse_clks_from_dt(struct platform_device *pdev,
 	}
 
 	pm_runtime_disable(&pdev->dev);
+	pm_runtime_dont_use_autosuspend(&pdev->dev);
 
 	return ret;
 }
-- 
2.47.3


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

* [PATCH 2/2] clk: imx: scu: add missing pm_runtime_dont_use_autosuspend() call
  2026-09-15 10:33 [PATCH 0/2] clk: imx: add missing pm_runtime_dont_use_autosuspend() calls Joshua Crofts
  2026-09-15 10:33 ` [PATCH 1/2] clk: imx: clk-imx8qxp-lpcg: add missing pm_runtime_dont_use_autosuspend() Joshua Crofts
@ 2026-09-15 10:33 ` Joshua Crofts
  2026-09-16  9:24 ` [PATCH 0/2] clk: imx: add missing pm_runtime_dont_use_autosuspend() calls Johan Hovold
  2 siblings, 0 replies; 7+ messages in thread
From: Joshua Crofts @ 2026-09-15 10:33 UTC (permalink / raw)
  To: Abel Vesa, Peng Fan, Stephen Boyd, Brian Masney, Jerome Brunet,
	Frank Li, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam
  Cc: linux-clk, imx, linux-arm-kernel, linux-kernel, stable

imx_clk_scu_probe() disables PM runtime on failure, but doesn't call the
pm_runtime_dont_use_autosuspend() function, causing potential resource
leaks.

Add the missing function calls.

Found using Coccinelle.

Fixes: 18a50f82cd2f ("clk: imx: scu: Do not enable runtime PM for CPU clks")
Fixes: 78edeb080330 ("clk: imx: scu: add runtime pm support")
Cc: <stable@vger.kernel.org>
Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com>
---
 drivers/clk/imx/clk-scu.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/clk/imx/clk-scu.c b/drivers/clk/imx/clk-scu.c
index 44220e9c5c2a..18f73e679331 100644
--- a/drivers/clk/imx/clk-scu.c
+++ b/drivers/clk/imx/clk-scu.c
@@ -525,6 +525,7 @@ static int imx_clk_scu_probe(struct platform_device *pdev)
 		if (ret) {
 			pm_genpd_remove_device(dev);
 			pm_runtime_disable(dev);
+			pm_runtime_dont_use_autosuspend(dev);
 			return ret;
 		}
 	}
@@ -533,6 +534,7 @@ static int imx_clk_scu_probe(struct platform_device *pdev)
 			   clk->rsrc, clk->clk_type);
 	if (IS_ERR(hw)) {
 		pm_runtime_disable(dev);
+		pm_runtime_dont_use_autosuspend(dev);
 		return PTR_ERR(hw);
 	}
 
-- 
2.47.3


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

* Re: [PATCH 0/2] clk: imx: add missing pm_runtime_dont_use_autosuspend() calls
  2026-09-15 10:33 [PATCH 0/2] clk: imx: add missing pm_runtime_dont_use_autosuspend() calls Joshua Crofts
  2026-09-15 10:33 ` [PATCH 1/2] clk: imx: clk-imx8qxp-lpcg: add missing pm_runtime_dont_use_autosuspend() Joshua Crofts
  2026-09-15 10:33 ` [PATCH 2/2] clk: imx: scu: add missing pm_runtime_dont_use_autosuspend() call Joshua Crofts
@ 2026-09-16  9:24 ` Johan Hovold
  2026-09-16 16:11   ` Frank Li
  2 siblings, 1 reply; 7+ messages in thread
From: Johan Hovold @ 2026-09-16  9:24 UTC (permalink / raw)
  To: Joshua Crofts
  Cc: Abel Vesa, Peng Fan, Stephen Boyd, Brian Masney, Jerome Brunet,
	Frank Li, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	linux-clk, imx, linux-arm-kernel, linux-kernel

On Tue, Sep 15, 2026 at 10:33:43AM +0000, Joshua Crofts wrote:
> Several drivers in the clk subsystem forget to call dont_use_autosuspend()
> on teardown or error, causing potential resource leaks. This series adds
> the missing calls.

No, as I've explained repeatedly elsewhere, it does not cause any
resource leaks. [1][2]

The autosuspend setting leaks if you will, but that only matters in the
theoretical corner case of someone rebinding a different driver (which
will soon also taint the kernel).

So don't exaggerate the impact, this is essentially just a cleanup,
which is fine in itself.

Johan

[1] https://lore.kernel.org/all/aqpd3viN1UoZBkgL@hovoldconsulting.com/
[2] https://lore.kernel.org/linux-iio/aow51Nk-cet9qaUQ@hovoldconsulting.com/

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

* Re: [PATCH 0/2] clk: imx: add missing pm_runtime_dont_use_autosuspend() calls
  2026-09-16  9:24 ` [PATCH 0/2] clk: imx: add missing pm_runtime_dont_use_autosuspend() calls Johan Hovold
@ 2026-09-16 16:11   ` Frank Li
  2026-09-17  8:24     ` Joshua Crofts
  0 siblings, 1 reply; 7+ messages in thread
From: Frank Li @ 2026-09-16 16:11 UTC (permalink / raw)
  To: Johan Hovold
  Cc: Joshua Crofts, Abel Vesa, Peng Fan, Stephen Boyd, Brian Masney,
	Jerome Brunet, Frank Li, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, linux-clk, imx, linux-arm-kernel, linux-kernel

On Wed, Sep 16, 2026 at 11:24:32AM +0200, Johan Hovold wrote:
> On Tue, Sep 15, 2026 at 10:33:43AM +0000, Joshua Crofts wrote:
> > Several drivers in the clk subsystem forget to call dont_use_autosuspend()
> > on teardown or error, causing potential resource leaks. This series adds
> > the missing calls.
>
> No, as I've explained repeatedly elsewhere, it does not cause any
> resource leaks. [1][2]
>
> The autosuspend setting leaks if you will, but that only matters in the
> theoretical corner case of someone rebinding a different driver (which
> will soon also taint the kernel).
>
> So don't exaggerate the impact, this is essentially just a cleanup,
> which is fine in itself.

Is it possilbe to create/improve runtime pm API, let runtime_pm enable/disable
include these pair functions.

I get many similar patches since scan tools is more powerful now.

Frank

>
> Johan
>
> [1] https://lore.kernel.org/all/aqpd3viN1UoZBkgL@hovoldconsulting.com/
> [2] https://lore.kernel.org/linux-iio/aow51Nk-cet9qaUQ@hovoldconsulting.com/
>

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

* Re: [PATCH 0/2] clk: imx: add missing pm_runtime_dont_use_autosuspend() calls
  2026-09-16 16:11   ` Frank Li
@ 2026-09-17  8:24     ` Joshua Crofts
  2026-09-17  8:42       ` Joshua Crofts
  0 siblings, 1 reply; 7+ messages in thread
From: Joshua Crofts @ 2026-09-17  8:24 UTC (permalink / raw)
  To: Frank Li
  Cc: Johan Hovold, Abel Vesa, Peng Fan, Stephen Boyd, Brian Masney,
	Jerome Brunet, Frank Li, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, linux-clk, imx, linux-arm-kernel, linux-kernel

On Wed, 16 Sep 2026 11:11:54 -0500
Frank Li <Frank.li@oss.nxp.com> wrote:

> On Wed, Sep 16, 2026 at 11:24:32AM +0200, Johan Hovold wrote:
> > On Tue, Sep 15, 2026 at 10:33:43AM +0000, Joshua Crofts wrote:  
> > > Several drivers in the clk subsystem forget to call dont_use_autosuspend()
> > > on teardown or error, causing potential resource leaks. This series adds
> > > the missing calls.  
> >
> > No, as I've explained repeatedly elsewhere, it does not cause any
> > resource leaks. [1][2]
> >
> > The autosuspend setting leaks if you will, but that only matters in the
> > theoretical corner case of someone rebinding a different driver (which
> > will soon also taint the kernel).
> >
> > So don't exaggerate the impact, this is essentially just a cleanup,
> > which is fine in itself.  
> 
> Is it possilbe to create/improve runtime pm API, let runtime_pm enable/disable
> include these pair functions.
> 
> I get many similar patches since scan tools is more powerful now.

I suppose that could work. One would still have to scrub the kernel of legacy
use/dont_use_autosuspend() calls though, so it could end up being a large
patchset.

-- 
Kind regards,
Joshua Crofts

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

* Re: [PATCH 0/2] clk: imx: add missing pm_runtime_dont_use_autosuspend() calls
  2026-09-17  8:24     ` Joshua Crofts
@ 2026-09-17  8:42       ` Joshua Crofts
  0 siblings, 0 replies; 7+ messages in thread
From: Joshua Crofts @ 2026-09-17  8:42 UTC (permalink / raw)
  To: Frank Li
  Cc: Johan Hovold, Abel Vesa, Peng Fan, Stephen Boyd, Brian Masney,
	Jerome Brunet, Frank Li, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, linux-clk, imx, linux-arm-kernel, linux-kernel

On Thu, 17 Sep 2026 10:24:29 +0200
Joshua Crofts <joshua.crofts1@gmail.com> wrote:

> On Wed, 16 Sep 2026 11:11:54 -0500
> Frank Li <Frank.li@oss.nxp.com> wrote:
> 
> > On Wed, Sep 16, 2026 at 11:24:32AM +0200, Johan Hovold wrote:  
> > > On Tue, Sep 15, 2026 at 10:33:43AM +0000, Joshua Crofts wrote:    
> > > > Several drivers in the clk subsystem forget to call dont_use_autosuspend()
> > > > on teardown or error, causing potential resource leaks. This series adds
> > > > the missing calls.    
> > >
> > > No, as I've explained repeatedly elsewhere, it does not cause any
> > > resource leaks. [1][2]
> > >
> > > The autosuspend setting leaks if you will, but that only matters in the
> > > theoretical corner case of someone rebinding a different driver (which
> > > will soon also taint the kernel).
> > >
> > > So don't exaggerate the impact, this is essentially just a cleanup,
> > > which is fine in itself.    
> > 
> > Is it possilbe to create/improve runtime pm API, let runtime_pm enable/disable
> > include these pair functions.
> > 
> > I get many similar patches since scan tools is more powerful now.  
> 
> I suppose that could work. One would still have to scrub the kernel of legacy
> use/dont_use_autosuspend() calls though, so it could end up being a large
> patchset.
> 

On second thought, some drivers do tend to disable PM runtime system sleep
etc. so it probably isn't as simple as adding the autosuspend stuff to
enable/disable.

-- 
Kind regards,
Joshua Crofts

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

end of thread, other threads:[~2026-09-17  8:42 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-15 10:33 [PATCH 0/2] clk: imx: add missing pm_runtime_dont_use_autosuspend() calls Joshua Crofts
2026-09-15 10:33 ` [PATCH 1/2] clk: imx: clk-imx8qxp-lpcg: add missing pm_runtime_dont_use_autosuspend() Joshua Crofts
2026-09-15 10:33 ` [PATCH 2/2] clk: imx: scu: add missing pm_runtime_dont_use_autosuspend() call Joshua Crofts
2026-09-16  9:24 ` [PATCH 0/2] clk: imx: add missing pm_runtime_dont_use_autosuspend() calls Johan Hovold
2026-09-16 16:11   ` Frank Li
2026-09-17  8:24     ` Joshua Crofts
2026-09-17  8:42       ` Joshua Crofts

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®