summaryrefslogtreecommitdiffstats
path: root/drivers/usb/musb/phy-am335x.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/musb/phy-am335x.c')
-rw-r--r--drivers/usb/musb/phy-am335x.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/drivers/usb/musb/phy-am335x.c b/drivers/usb/musb/phy-am335x.c
index df31255d89..f2e870d7ee 100644
--- a/drivers/usb/musb/phy-am335x.c
+++ b/drivers/usb/musb/phy-am335x.c
@@ -5,7 +5,6 @@
#include <linux/err.h>
#include "am35x-phy-control.h"
#include "musb_core.h"
-#include "phy-am335x.h"
struct am335x_usbphy {
void __iomem *base;
@@ -14,13 +13,6 @@ struct am335x_usbphy {
struct usb_phy phy;
};
-static struct am335x_usbphy *am_usbphy;
-
-struct usb_phy *am335x_get_usb_phy(void)
-{
- return &am_usbphy->phy;
-}
-
static int am335x_init(struct usb_phy *phy)
{
struct am335x_usbphy *am_usbphy = container_of(phy, struct am335x_usbphy, phy);
@@ -31,6 +23,7 @@ static int am335x_init(struct usb_phy *phy)
static int am335x_phy_probe(struct device_d *dev)
{
+ struct am335x_usbphy *am_usbphy;
struct resource *iores;
int ret;
@@ -44,22 +37,27 @@ static int am335x_phy_probe(struct device_d *dev)
am_usbphy->base = IOMEM(iores->start);
am_usbphy->phy_ctrl = am335x_get_phy_control(dev);
- if (!am_usbphy->phy_ctrl)
- return -ENODEV;
+ if (IS_ERR(am_usbphy->phy_ctrl)) {
+ ret = PTR_ERR(am_usbphy->phy_ctrl);
+ goto err_release;
+ }
am_usbphy->id = of_alias_get_id(dev->device_node, "phy");
if (am_usbphy->id < 0) {
dev_err(dev, "Missing PHY id: %d\n", am_usbphy->id);
- return am_usbphy->id;
+ ret = am_usbphy->id;
+ goto err_release;
}
am_usbphy->phy.init = am335x_init;
- dev->priv = am_usbphy;
+ dev->priv = &am_usbphy->phy;
dev_info(dev, "am_usbphy %p enabled\n", &am_usbphy->phy);
return 0;
+err_release:
+ release_region(iores);
err_free:
free(am_usbphy);