diff options
Diffstat (limited to 'drivers/phy')
-rw-r--r-- | drivers/phy/Kconfig | 4 | ||||
-rw-r--r-- | drivers/phy/phy-core.c | 26 |
2 files changed, 12 insertions, 18 deletions
diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index a344f3d52361..330ef2d06567 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig | |||
@@ -24,8 +24,8 @@ config PHY_EXYNOS_MIPI_VIDEO | |||
24 | config OMAP_USB2 | 24 | config OMAP_USB2 |
25 | tristate "OMAP USB2 PHY Driver" | 25 | tristate "OMAP USB2 PHY Driver" |
26 | depends on ARCH_OMAP2PLUS | 26 | depends on ARCH_OMAP2PLUS |
27 | depends on USB_PHY | ||
27 | select GENERIC_PHY | 28 | select GENERIC_PHY |
28 | select USB_PHY | ||
29 | select OMAP_CONTROL_USB | 29 | select OMAP_CONTROL_USB |
30 | help | 30 | help |
31 | Enable this to support the transceiver that is part of SOC. This | 31 | Enable this to support the transceiver that is part of SOC. This |
@@ -36,8 +36,8 @@ config OMAP_USB2 | |||
36 | config TWL4030_USB | 36 | config TWL4030_USB |
37 | tristate "TWL4030 USB Transceiver Driver" | 37 | tristate "TWL4030 USB Transceiver Driver" |
38 | depends on TWL4030_CORE && REGULATOR_TWL4030 && USB_MUSB_OMAP2PLUS | 38 | depends on TWL4030_CORE && REGULATOR_TWL4030 && USB_MUSB_OMAP2PLUS |
39 | depends on USB_PHY | ||
39 | select GENERIC_PHY | 40 | select GENERIC_PHY |
40 | select USB_PHY | ||
41 | help | 41 | help |
42 | Enable this to support the USB OTG transceiver on TWL4030 | 42 | Enable this to support the USB OTG transceiver on TWL4030 |
43 | family chips (including the TWL5030 and TPS659x0 devices). | 43 | family chips (including the TWL5030 and TPS659x0 devices). |
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, | |||
437 | int id; | 437 | int id; |
438 | struct phy *phy; | 438 | struct phy *phy; |
439 | 439 | ||
440 | if (!dev) { | 440 | if (WARN_ON(!dev)) |
441 | dev_WARN(dev, "no device provided for PHY\n"); | 441 | return ERR_PTR(-EINVAL); |
442 | ret = -EINVAL; | ||
443 | goto err0; | ||
444 | } | ||
445 | 442 | ||
446 | phy = kzalloc(sizeof(*phy), GFP_KERNEL); | 443 | phy = kzalloc(sizeof(*phy), GFP_KERNEL); |
447 | if (!phy) { | 444 | if (!phy) |
448 | ret = -ENOMEM; | 445 | return ERR_PTR(-ENOMEM); |
449 | goto err0; | ||
450 | } | ||
451 | 446 | ||
452 | id = ida_simple_get(&phy_ida, 0, 0, GFP_KERNEL); | 447 | id = ida_simple_get(&phy_ida, 0, 0, GFP_KERNEL); |
453 | if (id < 0) { | 448 | if (id < 0) { |
454 | dev_err(dev, "unable to get id\n"); | 449 | dev_err(dev, "unable to get id\n"); |
455 | ret = id; | 450 | ret = id; |
456 | goto err0; | 451 | goto free_phy; |
457 | } | 452 | } |
458 | 453 | ||
459 | device_initialize(&phy->dev); | 454 | device_initialize(&phy->dev); |
@@ -468,11 +463,11 @@ struct phy *phy_create(struct device *dev, const struct phy_ops *ops, | |||
468 | 463 | ||
469 | ret = dev_set_name(&phy->dev, "phy-%s.%d", dev_name(dev), id); | 464 | ret = dev_set_name(&phy->dev, "phy-%s.%d", dev_name(dev), id); |
470 | if (ret) | 465 | if (ret) |
471 | goto err1; | 466 | goto put_dev; |
472 | 467 | ||
473 | ret = device_add(&phy->dev); | 468 | ret = device_add(&phy->dev); |
474 | if (ret) | 469 | if (ret) |
475 | goto err1; | 470 | goto put_dev; |
476 | 471 | ||
477 | if (pm_runtime_enabled(dev)) { | 472 | if (pm_runtime_enabled(dev)) { |
478 | pm_runtime_enable(&phy->dev); | 473 | pm_runtime_enable(&phy->dev); |
@@ -481,12 +476,11 @@ struct phy *phy_create(struct device *dev, const struct phy_ops *ops, | |||
481 | 476 | ||
482 | return phy; | 477 | return phy; |
483 | 478 | ||
484 | err1: | 479 | put_dev: |
485 | ida_remove(&phy_ida, phy->id); | ||
486 | put_device(&phy->dev); | 480 | put_device(&phy->dev); |
481 | ida_remove(&phy_ida, phy->id); | ||
482 | free_phy: | ||
487 | kfree(phy); | 483 | kfree(phy); |
488 | |||
489 | err0: | ||
490 | return ERR_PTR(ret); | 484 | return ERR_PTR(ret); |
491 | } | 485 | } |
492 | EXPORT_SYMBOL_GPL(phy_create); | 486 | EXPORT_SYMBOL_GPL(phy_create); |