From: sashiko-bot@kernel.org
Cc: imx@lists.linux.dev, Frank.Li@kernel.org
Subject: Re: [PATCH] i2c: imx-lpi2c: reset controller in probe stage
Date: Tue, 19 May 2026 10:56:42 +0000 [thread overview]
Message-ID: <20260519105643.059F6C2BCB3@smtp.kernel.org> (raw)
In-Reply-To: <20260519104214.2794176-1-carlos.song@oss.nxp.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Moving devm_request_irq() after PM runtime initialization causes a PM runtime usage counter and clock leak if the IRQ request fails.
--
commit 3005ae3d3fdbe3e9115c8d88256efdcb9d2fcde9
Author: Carlos Song <carlos.song@nxp.com>
i2c: imx-lpi2c: reset controller in probe stage
This commit resets the I2C controller in the probe stage to avoid an
unexpected LPI2C controller state left from previous stages that could hang
system boot.
> diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c b/drivers/i2c/busses/i2c-imx-lpi2c.c
> index a01c236964819..da40b365a07f0 100644
> --- a/drivers/i2c/busses/i2c-imx-lpi2c.c
> +++ b/drivers/i2c/busses/i2c-imx-lpi2c.c
[ ... ]
> @@ -1535,10 +1530,23 @@ static int lpi2c_imx_probe(struct platform_device *pdev)
> pm_runtime_set_active(&pdev->dev);
> pm_runtime_enable(&pdev->dev);
>
> + /*
> + * Reset all internal controller logic and registers to avoid effects of previous status
> + * The reset takes effect immediately and there is no minimum delay required before
> + * clearing the software reset.
> + */
> + writel(MCR_RST, lpi2c_imx->base + LPI2C_MCR);
> + writel(0, lpi2c_imx->base + LPI2C_MCR);
> +
> temp = readl(lpi2c_imx->base + LPI2C_PARAM);
> lpi2c_imx->txfifosize = 1 << (temp & 0x0f);
> lpi2c_imx->rxfifosize = 1 << ((temp >> 8) & 0x0f);
>
> + ret = devm_request_irq(&pdev->dev, lpi2c_imx->irq, lpi2c_imx_isr, IRQF_NO_SUSPEND,
> + pdev->name, lpi2c_imx);
> + if (ret)
> + return dev_err_probe(&pdev->dev, ret, "can't claim irq %d\n", lpi2c_imx->irq);
Does this code leak the PM runtime usage counter and hardware clocks if the
IRQ request fails?
Because this block was moved after pm_runtime_enable() and
pm_runtime_set_active(), a direct return bypasses the rpm_disable cleanup
path.
Should this instead jump to rpm_disable rather than returning directly, so
that pm_runtime_put_sync() and pm_runtime_disable() can run and disable the
clocks?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260519104214.2794176-1-carlos.song@oss.nxp.com?part=1
prev parent reply other threads:[~2026-05-19 10:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-19 10:42 [PATCH] i2c: imx-lpi2c: reset controller in probe stage Carlos Song (OSS)
2026-05-19 10:56 ` sashiko-bot [this message]
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=20260519105643.059F6C2BCB3@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--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