Re: [PATCH v8 3/6] phy: fsl-imx8mq-usb: add runtime PM support
[email protected] Fri, 31 Jul 2026 08:21:20 +0000
| Newsgroups | dev.linux.lists.imx,org.infradead.lists.linux-phy |
|---|---|
| Message-ID | <[email protected]> |
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() cau= ses hardware orientation desynchronization. -- --- Patch [3]: [PATCH v8 3/6] phy: fsl-imx8mq-usb: add runtime PM support -= -- commit 2932b088ad1c6fda6302f9ed3f5778ccb0da73b9 Author: Xu Yang <[email protected]> phy: fsl-imx8mq-usb: add runtime PM support This commit adds runtime PM support to ensure the PHY clocks are properly=20 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/fre= escale/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_sw= itch_dev *sw, > { > struct imx8mq_usb_phy *imx_phy =3D typec_switch_get_drvdata(sw); > struct tca_blk *tca =3D imx_phy->tca; > - int ret; > =20 > if (tca->orientation =3D=3D 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. [ ... ] --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20260731-imx8mp-usb= [email protected]?part=3D3