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: vkoul@kernel.org, olteanv@gmail.com, imx@lists.linux.dev,
	neil.armstrong@linaro.org, linux-phy@lists.infradead.org,
	Frank.Li@kernel.org
Subject: Re: [PATCH v8 3/6] phy: fsl-imx8mq-usb: add runtime PM support
Date: Fri, 31 Jul 2026 08:21:20 +0000	[thread overview]
Message-ID: <20260731082121.3892A1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260731-imx8mp-usb-phy-improvement-v8-3-2ec8d6b3854d@nxp.com>

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

Pre-existing issues:
- [Medium] TOCTOU race in tca_blk_typec_switch_set() and tca_blk_init() causes hardware orientation desynchronization.
--

--- Patch [3]: [PATCH v8 3/6] phy: fsl-imx8mq-usb: add runtime PM support ---
commit 2932b088ad1c6fda6302f9ed3f5778ccb0da73b9
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 clocks are properly 
gated when the PHY is not in use, reducing power consumption. Clock
management is shifted from the power_on and power_off callbacks into the
new runtime PM callbacks.

> diff --git a/drivers/phy/freescale/phy-fsl-imx8mq-usb.c b/drivers/phy/freescale/phy-fsl-imx8mq-usb.c
> index 3a5788c609e1b..42de2cff4d5f3 100644
> --- a/drivers/phy/freescale/phy-fsl-imx8mq-usb.c
> +++ b/drivers/phy/freescale/phy-fsl-imx8mq-usb.c
[ ... ]
> @@ -136,17 +137,15 @@ static int tca_blk_typec_switch_set(struct typec_switch_dev *sw,
>  {
>  	struct imx8mq_usb_phy *imx_phy = typec_switch_get_drvdata(sw);
>  	struct tca_blk *tca = imx_phy->tca;
> -	int ret;
>  
>  	if (tca->orientation == orientation)
>  		return 0;

[Severity: Medium]
This is a pre-existing issue, but I noticed a potential race condition here.

Does this lockless equality check risk short-circuiting the orientation
switch update if it races with a concurrent initialization?

For instance, if tca_blk_init() is called concurrently during driver probe
or resume, it evaluates tca->orientation locklessly and passes it by value:

tca_blk_init()
    ...
    tca_blk_orientation_set(tca, tca->orientation);

Could tca_blk_typec_switch_set() return 0 here, returning success to the
Type-C core, while the hardware is simultaneously overwritten with a stale
state by tca_blk_init()? This might cause the hardware orientation to become
desynchronized from the Type-C subsystem's expected state, potentially
misrouting USB 3.0 data lines.

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260731-imx8mp-usb-phy-improvement-v8-0-2ec8d6b3854d@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-07-31  8:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-31  8:11 [PATCH v8 0/6] phy: fsl-imx8mq-usb: few improvements Xu Yang
2026-07-31  8:11 ` [PATCH v8 1/6] phy: fsl-imx8mq-usb: fix typec switch leak on probe error path Xu Yang
2026-07-31  8:19   ` sashiko-bot
2026-07-31  8:11 ` [PATCH v8 2/6] phy: fsl-imx8mq-usb: set usb phy to be wakeup capable Xu Yang
2026-07-31  8:11 ` [PATCH v8 3/6] phy: fsl-imx8mq-usb: add runtime PM support Xu Yang
2026-07-31  8:21   ` sashiko-bot [this message]
2026-07-31  8:11 ` [PATCH v8 4/6] phy: fsl-imx8mq-usb: add control register regmap Xu Yang
2026-07-31  8:27   ` sashiko-bot
2026-07-31  8:11 ` [PATCH v8 5/6] phy: fsl-imx8mq-usb: introduce per-variant driver data structure Xu Yang
2026-07-31  8:11 ` [PATCH v8 6/6] phy: fsl-imx8mq-usb: keep PHY power domain runtime always-on for i.MX8MP Xu Yang

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=20260731082121.3892A1F000E9@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