Skip to content

Commit a53469a

Browse files
liubiinFelipe Balbi
authored andcommitted
usb: phy: am335x: fix race condition in _probe
power off the phy should be done before populate the phy. Otherwise, am335x_init() could be called by the phy owner to power on the phy first, then am335x_phy_probe() turns off the phy again without the caller knowing it. Fixes: 2fc711d ("usb: phy: am335x: Enable USB remote wakeup using PHY wakeup") Cc: stable@vger.kernel.org # v3.18+ Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
1 parent 512e6fb commit a53469a

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

drivers/usb/phy/phy-am335x.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,6 @@ static int am335x_phy_probe(struct platform_device *pdev)
6161
if (ret)
6262
return ret;
6363

64-
ret = usb_add_phy_dev(&am_phy->usb_phy_gen.phy);
65-
if (ret)
66-
return ret;
6764
am_phy->usb_phy_gen.phy.init = am335x_init;
6865
am_phy->usb_phy_gen.phy.shutdown = am335x_shutdown;
6966

@@ -82,7 +79,7 @@ static int am335x_phy_probe(struct platform_device *pdev)
8279
device_set_wakeup_enable(dev, false);
8380
phy_ctrl_power(am_phy->phy_ctrl, am_phy->id, am_phy->dr_mode, false);
8481

85-
return 0;
82+
return usb_add_phy_dev(&am_phy->usb_phy_gen.phy);
8683
}
8784

8885
static int am335x_phy_remove(struct platform_device *pdev)

0 commit comments

Comments
 (0)