mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Frank Li <Frank.li@oss.nxp.com>
To: Wentao Liang <vulab@iscas.ac.cn>
Cc: broonie@kernel.org, haibo.chen@nxp.com, han.xu@nxp.com,
	imx@lists.linux.dev, linux-kernel@vger.kernel.org,
	linux-spi@vger.kernel.org, yogeshgaur.83@gmail.com,
	stable@vger.kernel.org
Subject: Re: [PATCH] spi: nxp-fspi: Fix runtime PM leak in nxp_fspi_probe()
Date: Thu, 17 Sep 2026 13:39:06 -0500	[thread overview]
Message-ID: <aqwzyjKASxfxtxTT@SMW015318> (raw)
In-Reply-To: <20260917153713.2160743-1-vulab@iscas.ac.cn>

On Thu, Sep 17, 2026 at 03:37:13PM +0000, Wentao Liang wrote:
> pm_runtime_get_sync() increments the runtime PM usage counter even when
> it fails.  If it returns an error, nxp_fspi_probe() returns without
> dropping that reference, so the counter stays unbalanced.
>
> Balance the counter with pm_runtime_put_noidle() before returning, as
> nxp_fspi_remove() already does.
>
> Fixes: 97be4b919a60 ("spi: spi-nxp-fspi: enable runtime pm for fspi")
> Cc: stable@vger.kernel.org
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
> ---
>  drivers/spi/spi-nxp-fspi.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/spi/spi-nxp-fspi.c b/drivers/spi/spi-nxp-fspi.c
> index 1e36ae084dd8..9883e5149dc4 100644
> --- a/drivers/spi/spi-nxp-fspi.c
> +++ b/drivers/spi/spi-nxp-fspi.c
> @@ -1351,8 +1351,10 @@ static int nxp_fspi_probe(struct platform_device *pdev)
>
>  	/* enable clock */
>  	ret = pm_runtime_get_sync(f->dev);
> -	if (ret < 0)
> +	if (ret < 0) {
> +		pm_runtime_put_noidle(f->dev);
>  		return dev_err_probe(dev, ret, "Failed to enable clock");
> +	}


use pm_runtime_resume_and_get()

Frank
>
>  	/* Clear potential interrupts */
>  	reg = fspi_readl(f, f->iobase + FSPI_INTR);
> --
> 2.34.1
>
>

  reply	other threads:[~2026-09-17 18:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-17 15:37 Wentao Liang
2026-09-17 18:39 ` Frank Li [this message]
2026-09-17 19:26   ` Mark Brown

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=aqwzyjKASxfxtxTT@SMW015318 \
    --to=frank.li@oss.nxp.com \
    --cc=broonie@kernel.org \
    --cc=haibo.chen@nxp.com \
    --cc=han.xu@nxp.com \
    --cc=imx@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=vulab@iscas.ac.cn \
    --cc=yogeshgaur.83@gmail.com \
    /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

all inboxes | Powered by JetHome®