diff options
author | Dmitry Osipenko <digetx@gmail.com> | 2020-01-06 04:34:07 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-01-09 16:21:58 +0100 |
commit | 875417471e9c0c3bb311a007d99390d9f5339b81 (patch) | |
tree | e434be87e5b8ffbb5eef9ba10af9cbe64b141618 /drivers/usb/phy | |
parent | dea75ee6c98474c966bb12164cdebc1daddcd86b (diff) | |
download | linux-875417471e9c0c3bb311a007d99390d9f5339b81.tar.bz2 |
usb: phy: tegra: Use devm_otg_ulpi_create()
The resource-managed variant removes the necessity for the driver to care
about freeing ULPI resources.
Suggested-by: Thierry Reding <thierry.reding@gmail.com>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Link: https://lore.kernel.org/r/20200106013416.9604-12-digetx@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/phy')
-rw-r--r-- | drivers/usb/phy/phy-tegra-usb.c | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/drivers/usb/phy/phy-tegra-usb.c b/drivers/usb/phy/phy-tegra-usb.c index 5b9f031619c5..9adbcdf8d3a1 100644 --- a/drivers/usb/phy/phy-tegra-usb.c +++ b/drivers/usb/phy/phy-tegra-usb.c @@ -1100,6 +1100,7 @@ static int tegra_usb_phy_probe(struct platform_device *pdev) enum usb_phy_interface phy_type; struct reset_control *reset; struct resource *res; + struct usb_phy *phy; int err; tegra_phy = devm_kzalloc(&pdev->dev, sizeof(*tegra_phy), GFP_KERNEL); @@ -1200,12 +1201,14 @@ static int tegra_usb_phy_probe(struct platform_device *pdev) return err; } - tegra_phy->ulpi = otg_ulpi_create(&ulpi_viewport_access_ops, 0); - if (!tegra_phy->ulpi) { + phy = devm_otg_ulpi_create(&pdev->dev, + &ulpi_viewport_access_ops, 0); + if (!phy) { dev_err(&pdev->dev, "Failed to create ULPI OTG\n"); return -ENOMEM; } + tegra_phy->ulpi = phy; tegra_phy->ulpi->io_priv = tegra_phy->regs + ULPI_VIEWPORT; break; @@ -1224,17 +1227,9 @@ static int tegra_usb_phy_probe(struct platform_device *pdev) err = usb_add_phy_dev(&tegra_phy->u_phy); if (err) - goto free_ulpi; + return err; return 0; - -free_ulpi: - if (tegra_phy->ulpi) { - kfree(tegra_phy->ulpi->otg); - kfree(tegra_phy->ulpi); - } - - return err; } static int tegra_usb_phy_remove(struct platform_device *pdev) @@ -1243,11 +1238,6 @@ static int tegra_usb_phy_remove(struct platform_device *pdev) usb_remove_phy(&tegra_phy->u_phy); - if (tegra_phy->ulpi) { - kfree(tegra_phy->ulpi->otg); - kfree(tegra_phy->ulpi); - } - return 0; } |