aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/phy/phy-core.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/phy/phy-core.c')
-rw-r--r--drivers/phy/phy-core.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
index c64a2f3b2d62..49c446530101 100644
--- a/drivers/phy/phy-core.c
+++ b/drivers/phy/phy-core.c
@@ -614,8 +614,9 @@ struct phy *phy_create(struct device *dev, const struct phy_ops *ops,
614 return phy; 614 return phy;
615 615
616put_dev: 616put_dev:
617 put_device(&phy->dev); 617 put_device(&phy->dev); /* calls phy_release() which frees resources */
618 ida_remove(&phy_ida, phy->id); 618 return ERR_PTR(ret);
619
619free_phy: 620free_phy:
620 kfree(phy); 621 kfree(phy);
621 return ERR_PTR(ret); 622 return ERR_PTR(ret);
@@ -799,7 +800,7 @@ static void phy_release(struct device *dev)
799 800
800 phy = to_phy(dev); 801 phy = to_phy(dev);
801 dev_vdbg(dev, "releasing '%s'\n", dev_name(dev)); 802 dev_vdbg(dev, "releasing '%s'\n", dev_name(dev));
802 ida_remove(&phy_ida, phy->id); 803 ida_simple_remove(&phy_ida, phy->id);
803 kfree(phy); 804 kfree(phy);
804} 805}
805 806