summaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorBin Liu <b-liu@ti.com>2019-01-16 11:54:07 -0600
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-02-20 10:09:06 +0100
commitd6055cc520ab64637025df0f2eb390001d3ee88b (patch)
tree006b98fdfc06b285cc4ebfcdc4b42e24509d384d /drivers/usb
parent76b24a3f462d5ffc16351ee869087447326179f9 (diff)
downloadlinux-stable-d6055cc520ab64637025df0f2eb390001d3ee88b.tar.gz
linux-stable-d6055cc520ab64637025df0f2eb390001d3ee88b.tar.bz2
linux-stable-d6055cc520ab64637025df0f2eb390001d3ee88b.zip
usb: phy: am335x: fix race condition in _probe
commit a53469a68eb886e84dd8b69a1458a623d3591793 upstream. 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: 2fc711d76352 ("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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/phy/phy-am335x.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/usb/phy/phy-am335x.c b/drivers/usb/phy/phy-am335x.c
index b70e05537180..3417463a9eb0 100644
--- a/drivers/usb/phy/phy-am335x.c
+++ b/drivers/usb/phy/phy-am335x.c
@@ -56,9 +56,6 @@ static int am335x_phy_probe(struct platform_device *pdev)
if (ret)
return ret;
- ret = usb_add_phy_dev(&am_phy->usb_phy_gen.phy);
- if (ret)
- return ret;
am_phy->usb_phy_gen.phy.init = am335x_init;
am_phy->usb_phy_gen.phy.shutdown = am335x_shutdown;
@@ -77,7 +74,7 @@ static int am335x_phy_probe(struct platform_device *pdev)
device_set_wakeup_enable(dev, false);
phy_ctrl_power(am_phy->phy_ctrl, am_phy->id, false);
- return 0;
+ return usb_add_phy_dev(&am_phy->usb_phy_gen.phy);
}
static int am335x_phy_remove(struct platform_device *pdev)