summaryrefslogtreecommitdiffstats
path: root/drivers/phy/phy-omap-usb2.c
diff options
context:
space:
mode:
authorRoger Quadros <rogerq@ti.com>2014-07-10 08:25:03 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-07-12 03:23:50 +0200
commiteb82a3d846fab00c4b9ad6bbe5ade4fa5febc0af (patch)
treed200444e54061fad1c7209dd6a2716815afa55cb /drivers/phy/phy-omap-usb2.c
parentphy: core: Fix error path in phy_create() (diff)
downloadlinux-eb82a3d846fab00c4b9ad6bbe5ade4fa5febc0af.tar.xz
linux-eb82a3d846fab00c4b9ad6bbe5ade4fa5febc0af.zip
phy: omap-usb2: Balance pm_runtime_enable() on probe failure and remove
If probe fails then we need to call pm_runtime_disable() to balance out the previous pm_runtime_enable() call. Else it will cause unbalanced pm_runtime_enable() call in the succeding probe call. This anomaly was observed when the call to devm_phy_create() failed with -EPROBE_DEFER. Balance out the pm_runtime_enable() call in .remove() as well. Signed-off-by: Roger Quadros <rogerq@ti.com> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to '')
-rw-r--r--drivers/phy/phy-omap-usb2.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c
index 2063d542b4e4..34b396146c8a 100644
--- a/drivers/phy/phy-omap-usb2.c
+++ b/drivers/phy/phy-omap-usb2.c
@@ -262,7 +262,6 @@ static int omap_usb2_probe(struct platform_device *pdev)
otg->phy = &phy->phy;
platform_set_drvdata(pdev, phy);
- pm_runtime_enable(phy->dev);
generic_phy = devm_phy_create(phy->dev, &ops, NULL);
if (IS_ERR(generic_phy))
@@ -270,10 +269,13 @@ static int omap_usb2_probe(struct platform_device *pdev)
phy_set_drvdata(generic_phy, phy);
+ pm_runtime_enable(phy->dev);
phy_provider = devm_of_phy_provider_register(phy->dev,
of_phy_simple_xlate);
- if (IS_ERR(phy_provider))
+ if (IS_ERR(phy_provider)) {
+ pm_runtime_disable(phy->dev);
return PTR_ERR(phy_provider);
+ }
phy->wkupclk = devm_clk_get(phy->dev, "wkupclk");
if (IS_ERR(phy->wkupclk)) {
@@ -317,6 +319,7 @@ static int omap_usb2_remove(struct platform_device *pdev)
if (!IS_ERR(phy->optclk))
clk_unprepare(phy->optclk);
usb_remove_phy(&phy->phy);
+ pm_runtime_disable(phy->dev);
return 0;
}