All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: Zhipeng.wang_1@oss.nxp.com
Cc: imx@lists.linux.dev, Frank.Li@kernel.org
Subject: Re: [PATCH v5 6/9] irqchip/imx-irqsteer: Let devres own the clock and runtime PM
Date: Fri, 21 Aug 2026 10:26:34 +0000	[thread overview]
Message-ID: <20260821102635.4BD041F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260821101039.4037925-7-Zhipeng.wang_1@oss.nxp.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Missing pm_runtime_put_noidle() in remove() causes a usage counter leak, permanently breaking autosuspend upon driver rebind.
- [Medium] Ignoring the return value of pm_runtime_resume_and_get() in remove() can lead to a clock enable count underflow during devres cleanup.
--

--- Patch [6]: [PATCH v5 6/9] irqchip/imx-irqsteer: Let devres own the clock and runtime PM ---
commit 57b65e0ae0ccb7952253c0bbf59f0e1f037ea934
Author: Zhipeng Wang <zhipeng.wang_1@nxp.com>

irqchip/imx-irqsteer: Let devres own the clock and runtime PM

In preparation for making the driver unbindable/reloadable, let the
driver core own the clock and runtime PM lifetime so that the probe()
error path and remove() do not have to hand-balance them.

> diff --git a/drivers/irqchip/irq-imx-irqsteer.c b/drivers/irqchip/irq-imx-irqsteer.c
> index b63bf957ab884..c2f58787f9a86 100644
> --- a/drivers/irqchip/irq-imx-irqsteer.c
> +++ b/drivers/irqchip/irq-imx-irqsteer.c

[ ... ]

> @@ -289,6 +292,14 @@ static void imx_irqsteer_remove(struct platform_device *pdev)
>  	struct irqsteer_data *irqsteer_data = platform_get_drvdata(pdev);
>  	int i;
>  
> +	/*
> +	 * The device may be runtime-suspended here, in which case the
> +	 * runtime suspend callback has already dropped the clock enable
> +	 * count. Resume it so the devres clk_disable_unprepare(), which
> +	 * runs after remove(), finds the clock enabled and stays balanced.
> +	 */
> +	pm_runtime_resume_and_get(&pdev->dev);

[Severity: Medium]
Is it safe to ignore the return value of pm_runtime_resume_and_get() here?

If it fails (for example, if clk_enable() fails in imx_irqsteer_resume()), 
the device will remain suspended and the clock disabled. When devres 
subsequently runs clk_disable_unprepare() during cleanup, wouldn't this 
cause a clock enable count underflow?

[Severity: High]
Does this leak the runtime PM usage counter on driver unbind?

pm_runtime_resume_and_get() increments dev->power.usage_count on success, 
but there doesn't appear to be a matching pm_runtime_put_noidle() or similar 
put call before imx_irqsteer_remove() returns.

Since the devres action registered by devm_pm_runtime_set_active_enabled() 
only calls pm_runtime_disable() (which does not drop the usage count), 
wouldn't this permanently break autosuspend when the driver is rebound?

> +
>  	for (i = 0; i < irqsteer_data->irq_count; i++) {
>  		if (!irqsteer_data->irq[i])
>  			break;

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260821101039.4037925-1-Zhipeng.wang_1@oss.nxp.com?part=6

  reply	other threads:[~2026-08-21 10:26 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-21 10:10 [PATCH v5 0/9] irqchip/imx-irqsteer: Allow building as module Zhipeng.wang_1
2026-08-21 10:10 ` [PATCH v5 1/9] irqchip/imx-irqsteer: Call chained_irq_exit() on the handler error path Zhipeng.wang_1
2026-08-21 14:15   ` Frank Li
2026-08-29 20:54   ` Radu Rendec
2026-08-21 10:10 ` [PATCH v5 2/9] irqchip/imx-irqsteer: Use devm to manage the IRQ domain Zhipeng.wang_1
2026-08-21 10:10 ` [PATCH v5 3/9] irqchip/imx-irqsteer: Validate IRQ count before creating domain Zhipeng.wang_1
2026-08-21 14:24   ` Frank Li
2026-08-24  9:38     ` Zhipeng Wang (OSS)
2026-08-24 12:49       ` Fabio Estevam
2026-08-26  3:26         ` Zhipeng Wang (OSS)
2026-08-21 10:10 ` [PATCH v5 4/9] irqchip/imx-irqsteer: Dispose of parent IRQ mappings in remove() Zhipeng.wang_1
2026-08-30 16:30   ` Radu Rendec
2026-08-21 10:10 ` [PATCH v5 5/9] irqchip/imx-irqsteer: Mask all interrupts in probe() Zhipeng.wang_1
2026-08-30 18:51   ` Radu Rendec
2026-08-21 10:10 ` [PATCH v5 6/9] irqchip/imx-irqsteer: Let devres own the clock and runtime PM Zhipeng.wang_1
2026-08-21 10:26   ` sashiko-bot [this message]
2026-08-26  5:53     ` Zhipeng Wang (OSS)
2026-08-30 19:31   ` Radu Rendec
2026-08-31  8:30     ` Zhipeng Wang (OSS)
2026-08-21 10:10 ` [PATCH v5 7/9] irqchip/imx-irqsteer: Allow building as module Zhipeng.wang_1
2026-08-21 10:26   ` sashiko-bot
2026-09-03  1:16   ` Radu Rendec
2026-08-21 10:10 ` [PATCH v5 8/9] genirq/irqdomain: Add devm_irq_domain_create_linear() Zhipeng.wang_1
2026-08-21 10:10 ` [PATCH v5 9/9] irqchip/imx-irqsteer: Use devm_irq_domain_create_linear() Zhipeng.wang_1

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=20260821102635.4BD041F00A3D@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=Zhipeng.wang_1@oss.nxp.com \
    --cc=imx@lists.linux.dev \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.