Linux kernel and device drivers for NXP i.MX platforms
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Peng Fan" <peng.fan@linux.dev>
Cc: imx@lists.linux.dev, Frank.Li@kernel.org
Subject: Re: [PATCH 6/8] irqchip/imx-intmux: Use devm_clk_get_enabled()
Date: Tue, 17 Nov 2026 07:28:47 +0000	[thread overview]
Message-ID: <sashiko-outbox-218347@kernel.org> (raw)
In-Reply-To: <20261117-imx-intmux-v1-6-189e7e0ad98d@nxp.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] irqchip/imx-intmux: unbalanced clock disable in
  imx_intmux_remove() on error
--

commit d7b67b8e6922337551fee107f931cdac342397ec
Author: Peng Fan <peng.fan@nxp.com>

irqchip/imx-intmux: Use devm_clk_get_enabled()

This commit replaces devm_clk_get() and manual clk_prepare_enable() and
clk_disable_unprepare() calls for ipg_clk with devm_clk_get_enabled().

> diff --git a/drivers/irqchip/irq-imx-intmux.c b/drivers/irqchip/irq-imx-intmux.c
> index ebfff621e5a90..755c070073902 100644
> --- a/drivers/irqchip/irq-imx-intmux.c
> +++ b/drivers/irqchip/irq-imx-intmux.c
> @@ -226,7 +226,7 @@ static int imx_intmux_probe(struct platform_device *pdev)
>  		return PTR_ERR(data->regs);
>  	}
>  
> -	data->ipg_clk = devm_clk_get(&pdev->dev, "ipg");
> +	data->ipg_clk = devm_clk_get_enabled(&pdev->dev, "ipg");
>  	if (IS_ERR(data->ipg_clk))
>  		return dev_err_probe(&pdev->dev, PTR_ERR(data->ipg_clk),
>  				     "failed to get ipg clk\n");

[ ... ]

> @@ -323,7 +316,6 @@ static void imx_intmux_remove(struct platform_device *pdev)
>  	pm_runtime_disable(&pdev->dev);
>  	if (ret >= 0) {
>  		pm_runtime_put_noidle(&pdev->dev);
> -		clk_disable_unprepare(data->ipg_clk);
>  		pm_runtime_set_suspended(&pdev->dev);
>  	}
>  }

[Severity: Medium]
Can this underflow the enable and prepare counts on data->ipg_clk if
pm_runtime_resume_and_get() fails in imx_intmux_remove()?

At the end of imx_intmux_probe(), pm_runtime_put() allows runtime PM to
suspend the device via imx_intmux_runtime_suspend(), which calls
clk_disable_unprepare(data->ipg_clk).  Previously, imx_intmux_remove()
only disabled data->ipg_clk when pm_runtime_resume_and_get() succeeded
(ret >= 0).  With devm_clk_get_enabled(), devres unconditionally calls
clk_disable_unprepare(data->ipg_clk) after imx_intmux_remove() returns,
disabling the clock a second time when runtime resume fails.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261117-imx-intmux-v1-0-189e7e0ad98d@nxp.com?part=6

  reply	other threads:[~2026-11-17  7:28 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17  7:14 [PATCH 0/8] irqchip/imx-intmux: Fix and modernize resource management Peng Fan
2026-11-17  7:14 ` [PATCH 1/8] irqchip/imx-intmux: Fix probe error path Peng Fan
2026-11-17  7:26   ` sashiko-bot
2026-11-17  7:14 ` [PATCH 2/8] irqchip/imx-intmux: Dispose IRQ mappings on remove Peng Fan
2026-11-17  7:14 ` [PATCH 3/8] irqchip/imx-intmux: Handle platform_irq_count() errors Peng Fan
2026-11-17  7:26   ` sashiko-bot
2026-11-17  7:14 ` [PATCH 4/8] irqchip/imx-intmux: Don't WARN on malformed interrupt specifiers Peng Fan
2026-11-17  7:14 ` [PATCH 5/8] irqchip/imx-intmux: Mark input interrupts as level-triggered Peng Fan
2026-11-17  7:22   ` sashiko-bot
2026-11-17  7:14 ` [PATCH 6/8] irqchip/imx-intmux: Use devm_clk_get_enabled() Peng Fan
2026-11-17  7:28   ` sashiko-bot [this message]
2026-11-17  7:14 ` [PATCH 7/8] irqchip/imx-intmux: Use devm_irq_domain_create_linear() Peng Fan
2026-11-17  7:14 ` [PATCH 8/8] irqchip/imx-intmux: Use devm_pm_runtime_set_active_enabled() Peng Fan
2026-11-17  7:38   ` sashiko-bot
2026-11-17 13:27 ` [PATCH 0/8] irqchip/imx-intmux: Fix and modernize resource management 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=sashiko-outbox-218347@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=imx@lists.linux.dev \
    --cc=peng.fan@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox