Linux kernel and device drivers for NXP i.MX platforms
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Guangshuo Li" <lgs201920130244@gmail.com>
Cc: imx@lists.linux.dev, Frank.Li@kernel.org
Subject: Re: [PATCH] clk: imx: scu: fix autosuspend cleanup on probe failure
Date: Sat, 08 Aug 2026 08:47:25 +0000	[thread overview]
Message-ID: <20260808084726.608471F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260808082933.2692878-1-lgs201920130244@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Incomplete error path cleanup: usage counter leak and unbalanced runtime PM disable
--

--- Patch [1]: [PATCH] clk: imx: scu: fix autosuspend cleanup on probe failure ---
commit be1da3e608e79b11e6b956430089bc533d7bfdbd
Author: Guangshuo Li <lgs201920130244@gmail.com>

clk: imx: scu: fix autosuspend cleanup on probe failure

This commit adds missing calls to pm_runtime_dont_use_autosuspend in the
probe failure paths of the imx-scu clock driver. This prevents an unbalanced
usage counter when the autosuspend delay is set to a negative value.

> diff --git a/drivers/clk/imx/clk-scu.c b/drivers/clk/imx/clk-scu.c
> index 9b33df9967ece..6d29fcc2306d8 100644
> --- a/drivers/clk/imx/clk-scu.c
> +++ b/drivers/clk/imx/clk-scu.c

[ ... ]

> @@ -542,6 +542,7 @@ static int imx_clk_scu_probe(struct platform_device *pdev)
>  		ret = pm_runtime_resume_and_get(dev);
>  		if (ret) {
>  			pm_genpd_remove_device(dev);
> +			pm_runtime_dont_use_autosuspend(dev);
>  			pm_runtime_disable(dev);
>  			return ret;
>  		}
> @@ -550,6 +551,9 @@ static int imx_clk_scu_probe(struct platform_device *pdev)
>  	hw = __imx_clk_scu(dev, clk->name, clk->parents, clk->num_parents,
>  			   clk->rsrc, clk->clk_type);
>  	if (IS_ERR(hw)) {
> +		if (!(clk->rsrc == IMX_SC_R_A35 || clk->rsrc == IMX_SC_R_A53 ||
> +		      clk->rsrc == IMX_SC_R_A72))
> +			pm_runtime_dont_use_autosuspend(dev);
>  		pm_runtime_disable(dev);
>  		return PTR_ERR(hw);
>  	}

[Severity: High]
This isn't a bug introduced by this patch, but since this modifies the error
path, is there a missing call to pm_runtime_put_noidle here?

Earlier in imx_clk_scu_probe, for non-CPU clocks, pm_runtime_resume_and_get
is called and increments the usage counter on success. If __imx_clk_scu
subsequently fails, it appears the usage count is leaked, which would
prevent the device and its power domain from ever suspending.

Also, pm_runtime_disable is called unconditionally here, but
pm_runtime_enable was only called if the clock was a non-CPU clock. Does
this cause an unbalanced runtime PM disable depth for CPU clocks?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260808082933.2692878-1-lgs201920130244@gmail.com?part=1

  reply	other threads:[~2026-08-08  8:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-08  8:29 [PATCH] clk: imx: scu: fix autosuspend cleanup on probe failure Guangshuo Li
2026-08-08  8:47 ` sashiko-bot [this message]
2026-08-10 13:03 ` Peng Fan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260808084726.608471F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=imx@lists.linux.dev \
    --cc=lgs201920130244@gmail.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox