[PATCH v8 3/6] phy: fsl-imx8mq-usb: add runtime PM support
sashiko-bot at kernel.org
sashiko-bot at kernel.org
Fri Jul 31 01:21:20 PDT 2026
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 at 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
More information about the linux-phy
mailing list