diff options
| author | Ingo Molnar <mingo@kernel.org> | 2014-01-12 20:56:29 +0400 |
|---|---|---|
| committer | Ingo Molnar <mingo@kernel.org> | 2014-01-12 20:56:29 +0400 |
| commit | da4540757d35a98a350d6e8d882a64b2d04f8581 (patch) | |
| tree | ad77d8752f5db40497c819f051cbae12effb8163 /drivers/phy/phy-core.c | |
| parent | cc131eef1cec905b9bdb0be6d7ab3af86f23de98 (diff) | |
| parent | 7e22e91102c6b9df7c4ae2168910e19d2bb14cd6 (diff) | |
| download | linux-da4540757d35a98a350d6e8d882a64b2d04f8581.tar.xz | |
Merge tag 'v3.13-rc8' into x86/ras, to pick up fixes.
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'drivers/phy/phy-core.c')
| -rw-r--r-- | drivers/phy/phy-core.c | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c index 03cf8fb81554..58e0e9739028 100644 --- a/drivers/phy/phy-core.c +++ b/drivers/phy/phy-core.c @@ -437,23 +437,18 @@ struct phy *phy_create(struct device *dev, const struct phy_ops *ops, int id; struct phy *phy; - if (!dev) { - dev_WARN(dev, "no device provided for PHY\n"); - ret = -EINVAL; - goto err0; - } + if (WARN_ON(!dev)) + return ERR_PTR(-EINVAL); phy = kzalloc(sizeof(*phy), GFP_KERNEL); - if (!phy) { - ret = -ENOMEM; - goto err0; - } + if (!phy) + return ERR_PTR(-ENOMEM); id = ida_simple_get(&phy_ida, 0, 0, GFP_KERNEL); if (id < 0) { dev_err(dev, "unable to get id\n"); ret = id; - goto err0; + goto free_phy; } device_initialize(&phy->dev); @@ -468,11 +463,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 put_dev; ret = device_add(&phy->dev); if (ret) - goto err1; + goto put_dev; if (pm_runtime_enabled(dev)) { pm_runtime_enable(&phy->dev); @@ -481,12 +476,11 @@ struct phy *phy_create(struct device *dev, const struct phy_ops *ops, return phy; -err1: - ida_remove(&phy_ida, phy->id); +put_dev: put_device(&phy->dev); + ida_remove(&phy_ida, phy->id); +free_phy: kfree(phy); - -err0: return ERR_PTR(ret); } EXPORT_SYMBOL_GPL(phy_create); |
