diff options
author | Sachin Kamat <sachin.kamat@linaro.org> | 2013-12-06 17:51:18 +0530 |
---|---|---|
committer | Chanho Park <chanho61.park@samsung.com> | 2014-11-18 11:47:44 +0900 |
commit | f79356d0c1f3a92b3519e06311b081e7a16bc3f4 (patch) | |
tree | 8ceca19fb706d81b988f724582e2e80a19efb477 /drivers/phy | |
parent | 1013ada4d49df511a2587cf20a14fe0fbddae5d6 (diff) | |
download | linux-3.10-f79356d0c1f3a92b3519e06311b081e7a16bc3f4.tar.gz linux-3.10-f79356d0c1f3a92b3519e06311b081e7a16bc3f4.tar.bz2 linux-3.10-f79356d0c1f3a92b3519e06311b081e7a16bc3f4.zip |
drivers: phy: Fix memory leak
'phy' was not being freed upon error in one of the cases.
Adjust the 'goto's to fix this.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[backport from upstream commit c1b1731d2002b93857810aa5da856b43f46bb470]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I170f5d157e97077e50f059dbecdcb0877fd1a680
Diffstat (limited to 'drivers/phy')
-rw-r--r-- | drivers/phy/phy-core.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c index 03cf8fb8155..712b358a575 100644 --- a/drivers/phy/phy-core.c +++ b/drivers/phy/phy-core.c @@ -453,7 +453,7 @@ struct phy *phy_create(struct device *dev, const struct phy_ops *ops, if (id < 0) { dev_err(dev, "unable to get id\n"); ret = id; - goto err0; + goto err1; } device_initialize(&phy->dev); @@ -468,11 +468,11 @@ struct phy *phy_create(struct device *dev, const struct phy_ops *ops, ret = dev_set_name(&phy->dev, "phy-%s.%d", dev_name(dev), id); if (ret) - goto err1; + goto err2; ret = device_add(&phy->dev); if (ret) - goto err1; + goto err2; if (pm_runtime_enabled(dev)) { pm_runtime_enable(&phy->dev); @@ -481,11 +481,11 @@ struct phy *phy_create(struct device *dev, const struct phy_ops *ops, return phy; -err1: +err2: ida_remove(&phy_ida, phy->id); put_device(&phy->dev); +err1: kfree(phy); - err0: return ERR_PTR(ret); } |