Linux kernel and device drivers for NXP i.MX platforms
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Sebastian Andrzej Siewior" <bigeasy@linutronix.de>
Cc: Frank.Li@kernel.org, imx@lists.linux.dev
Subject: Re: [PATCH v2 5/9] mailbox: imx: Start splitting the IRQ handler in primary and threaded handler
Date: Wed, 03 Jun 2026 13:58:22 +0000	[thread overview]
Message-ID: <20260603135823.1094E1F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260603-imx_mbox_rproc-v2-5-a0059dc3b69a@linutronix.de>

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

New issues:
- [Medium] Double `clk_disable_unprepare()` on `devm_mbox_controller_register()` error path.

Pre-existing issues:
- [High] Unchecked return value of `pm_runtime_get_sync()` can lead to synchronous external aborts.
--

commit 2c0acf5c8fb62883e0037f32b817dbaada81aae9
Author: Sebastian Andrzej Siewior <bigeasy@linutronix.de>

mailbox: imx: Start splitting the IRQ handler in primary and threaded handler

This commit splits the mailbox IRQ handling into a primary handler and a
threaded handler. The primary handler masks the interrupt event, allowing the
threaded handler to run in a preemptible context without raising the interrupt
again. As a first step, it prepares the logic and moves the TX handling part.

> diff --git a/drivers/mailbox/imx-mailbox.c b/drivers/mailbox/imx-mailbox.c
> index d1de07cc0ed62..006aa76b74b62 100644
> --- a/drivers/mailbox/imx-mailbox.c
> +++ b/drivers/mailbox/imx-mailbox.c

[ ... ]

> @@ -629,7 +655,8 @@ static int imx_mu_startup(struct mbox_chan *chan)
>  	if (!(priv->dcfg->type & IMX_MU_V2_IRQ))
>  		irq_flag |= IRQF_SHARED;
>  
> -	ret = request_irq(priv->irq[cp->type], imx_mu_isr, irq_flag, cp->irq_desc, chan);
> +	ret = request_threaded_irq(priv->irq[cp->type], imx_mu_isr, imx_mu_isr_th,
> +				   irq_flag, cp->irq_desc, chan);

[Severity: High]
This isn't a bug introduced by this patch, but looking at imx_mu_startup()
in drivers/mailbox/imx-mailbox.c, the return value of pm_runtime_get_sync()
is ignored:

	pm_runtime_get_sync(priv->dev);
	if (cp->type == IMX_MU_TYPE_TXDB_V2)
		return 0;

If the PM domain fails to resume (for example, returning -ENOMEM or
-ETIMEDOUT), will the function proceed to interact with hardware registers?
On i.MX platforms, accessing unclocked or unpowered hardware registers
typically results in a synchronous external abort and a kernel panic.

>  	if (ret) {
>  		dev_err(priv->dev, "Unable to acquire IRQ %d\n", priv->irq[cp->type]);
>  		return ret;

[Severity: Medium]
Looking at the driver changes introduced earlier in this patch series
(specifically "mailbox: imx: Use devm_pm_runtime_enable()"), there appears
to be a double clock disable issue on the error path:

drivers/mailbox/imx-mailbox.c:imx_mu_probe() {
...
	clk_disable_unprepare(priv->clk);

	ret = devm_mbox_controller_register(dev, &priv->mbox);
	if (ret)
		goto disable_clk;
...
disable_clk:
	clk_disable_unprepare(priv->clk);
	return ret;
}

Could this cause the clock reference count to underflow and trigger a
warning in the clock framework if devm_mbox_controller_register() fails?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260603-imx_mbox_rproc-v2-0-a0059dc3b69a@linutronix.de?part=5

  reply	other threads:[~2026-06-03 13:58 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-03 13:05 [PATCH v2 0/9] mailbox: imx: Use threaded handler to avoid kworker in imx's remoteproc Sebastian Andrzej Siewior
2026-06-03 13:05 ` [PATCH v2 1/9] mailbox: imx: Add a channel shutdown field Sebastian Andrzej Siewior
2026-06-03 13:20   ` sashiko-bot
2026-06-03 14:59     ` Sebastian Andrzej Siewior
2026-06-03 13:05 ` [PATCH v2 2/9] mailbox: imx: Use devm_pm_runtime_enable() Sebastian Andrzej Siewior
2026-06-03 13:27   ` sashiko-bot
2026-06-03 15:00     ` Sebastian Andrzej Siewior
2026-06-03 13:05 ` [PATCH v2 3/9] mailbox: imx: use devm_of_platform_populate() Sebastian Andrzej Siewior
2026-06-03 13:37   ` sashiko-bot
2026-06-03 15:01     ` Sebastian Andrzej Siewior
2026-06-03 13:05 ` [PATCH v2 4/9] mailbox: imx: Use channel index instead of zero in imx_mu_specific_rx() Sebastian Andrzej Siewior
2026-06-03 13:05 ` [PATCH v2 5/9] mailbox: imx: Start splitting the IRQ handler in primary and threaded handler Sebastian Andrzej Siewior
2026-06-03 13:58   ` sashiko-bot [this message]
2026-06-03 15:07     ` Sebastian Andrzej Siewior
2026-06-03 13:05 ` [PATCH v2 6/9] mailbox: imx: Move the RX part of the mailbox into the " Sebastian Andrzej Siewior
2026-06-03 13:18   ` Daniel Baluta
2026-06-03 13:20     ` Sebastian Andrzej Siewior
2026-06-03 13:45       ` Daniel Baluta
2026-06-03 15:26         ` Sebastian Andrzej Siewior
2026-06-03 13:05 ` [PATCH v2 7/9] mailbox: imx: Move the RXDB " Sebastian Andrzej Siewior
2026-06-03 14:19   ` sashiko-bot
2026-06-03 13:05 ` [PATCH v2 8/9] mailbox: imx: Don't force-thread the primary handler Sebastian Andrzej Siewior
2026-06-03 14:31   ` sashiko-bot
2026-06-03 15:20     ` Sebastian Andrzej Siewior
2026-06-03 13:05 ` [PATCH v2 9/9] remoteproc: imx_rproc: Invoke the callback directly Sebastian Andrzej Siewior
2026-06-03 14:45   ` sashiko-bot
2026-06-03 15:21     ` Sebastian Andrzej Siewior

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=20260603135823.1094E1F00893@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=bigeasy@linutronix.de \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox