Linux-PHY Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Xu Yang" <xu.yang_2@oss.nxp.com>
Cc: imx@lists.linux.dev, vkoul@kernel.org,
	linux-phy@lists.infradead.org, olteanv@gmail.com,
	Frank.Li@kernel.org, neil.armstrong@linaro.org
Subject: Re: [PATCH v5 3/5] phy: fsl-imx8mq-usb: add runtime PM support
Date: Tue, 30 Jun 2026 10:52:43 +0000	[thread overview]
Message-ID: <20260630105244.2CE621F00ACA@smtp.kernel.org> (raw)
In-Reply-To: <20260630-imx8mp-usb-phy-improvement-v5-3-25d616403844@nxp.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Missing `pm_runtime_disable()` in `imx8mq_usb_phy_probe()` error paths causes a `disable_depth` imbalance and PM state corruption.
--

commit e9418c8d510e8492ef9a52ace4cb6d672041d448
Author: Xu Yang <xu.yang_2@nxp.com>

phy: fsl-imx8mq-usb: add runtime PM support

This commit adds runtime PM support to ensure the PHY is properly powered
and clocked during register access, preventing potential system hangs.

> diff --git a/drivers/phy/freescale/phy-fsl-imx8mq-usb.c b/drivers/phy/freescale/phy-fsl-imx8mq-usb.c
> --- a/drivers/phy/freescale/phy-fsl-imx8mq-usb.c
> +++ b/drivers/phy/freescale/phy-fsl-imx8mq-usb.c

[ ... ]

> @@ -708,6 +695,9 @@ static int imx8mq_usb_phy_probe(struct platform_device *pdev)
>  	if (IS_ERR(imx_phy->base))
>  		return PTR_ERR(imx_phy->base);
>  
> +	pm_runtime_set_active(dev);
> +	pm_runtime_enable(dev);
> +
>  	phy_ops = of_device_get_match_data(dev);
>  	if (!phy_ops)
>  		return -EINVAL;

[Severity: High]
Does this code need a cleanup path to call pm_runtime_disable() on probe
failures?

If functions following pm_runtime_enable() fail (such as
of_device_get_match_data(), devm_phy_create(), or devm_regulator_get()),
the driver returns the error directly without cleaning up the PM state.

This can leave the disable_depth counter out of sync. If the device probe
defers (for example, if devm_regulator_get() returns -EPROBE_DEFER) and
runs again, the subsequent pm_runtime_enable() could drop the counter
below zero. This might trigger an unbalanced pm_runtime_enable warning
and leave the device permanently stuck in RPM_ACTIVE.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260630-imx8mp-usb-phy-improvement-v5-0-25d616403844@nxp.com?part=3

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

  reply	other threads:[~2026-06-30 10:52 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-30 10:11 [PATCH v5 0/5] phy: fsl-imx8mq-usb: few improvements Xu Yang
2026-06-30 10:11 ` [PATCH v5 1/5] phy: fsl-imx8mq-usb: fix typec switch leak on probe error path Xu Yang
2026-06-30 10:31   ` sashiko-bot
2026-06-30 10:11 ` [PATCH v5 2/5] phy: fsl-imx8mq-usb: set usb phy to be wakeup capable Xu Yang
2026-06-30 10:11 ` [PATCH v5 3/5] phy: fsl-imx8mq-usb: add runtime PM support Xu Yang
2026-06-30 10:52   ` sashiko-bot [this message]
2026-06-30 19:06   ` Frank Li
2026-06-30 10:11 ` [PATCH v5 4/5] phy: fsl-imx8mq-usb: add control register regmap Xu Yang
2026-06-30 11:13   ` sashiko-bot
2026-06-30 10:11 ` [PATCH v5 5/5] phy: fsl-imx8mq-usb: keep PHY power domain runtime always-on for i.MX8MP Xu Yang
2026-06-30 19:13   ` Frank Li

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=20260630105244.2CE621F00ACA@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=imx@lists.linux.dev \
    --cc=linux-phy@lists.infradead.org \
    --cc=neil.armstrong@linaro.org \
    --cc=olteanv@gmail.com \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=vkoul@kernel.org \
    --cc=xu.yang_2@oss.nxp.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