diff mbox

[1/2] usb: otg: OMAP4430: Fix omap4430_phy_init function

Message ID 1300964764-6794-1-git-send-email-hemahk@ti.com (mailing list archive)
State New, archived
Headers show

Commit Message

Kalliguddi, Hema March 24, 2011, 11:06 a.m. UTC
None
diff mbox

Patch

diff --git a/arch/arm/mach-omap2/omap_phy_internal.c b/arch/arm/mach-omap2/omap_phy_internal.c
index e2e605f..a959e2f 100644
--- a/arch/arm/mach-omap2/omap_phy_internal.c
+++ b/arch/arm/mach-omap2/omap_phy_internal.c
@@ -50,34 +50,36 @@  int omap4430_phy_init(struct device *dev)
 {
 	ctrl_base = ioremap(OMAP443X_SCM_BASE, SZ_1K);
 	if (!ctrl_base) {
-		dev_err(dev, "control module ioremap failed\n");
+		printk(KERN_ERR "control module ioremap failed\n");
 		return -ENOMEM;
 	}
 	/* Power down the phy */
 	__raw_writel(PHY_PD, ctrl_base + CONTROL_DEV_CONF);
-	phyclk = clk_get(dev, "ocp2scp_usb_phy_ick");
 
-	if (IS_ERR(phyclk)) {
-		dev_err(dev, "cannot clk_get ocp2scp_usb_phy_ick\n");
-		iounmap(ctrl_base);
-		return PTR_ERR(phyclk);
-	}
+	if (dev) {
+		phyclk = clk_get(dev, "ocp2scp_usb_phy_ick");
+		if (IS_ERR(phyclk)) {
+			dev_err(dev, "cannot clk_get ocp2scp_usb_phy_ick\n");
+			iounmap(ctrl_base);
+			return PTR_ERR(phyclk);
+		}
 
-	clk48m = clk_get(dev, "ocp2scp_usb_phy_phy_48m");
-	if (IS_ERR(clk48m)) {
-		dev_err(dev, "cannot clk_get ocp2scp_usb_phy_phy_48m\n");
-		clk_put(phyclk);
-		iounmap(ctrl_base);
-		return PTR_ERR(clk48m);
-	}
+		clk48m = clk_get(dev, "ocp2scp_usb_phy_phy_48m");
+		if (IS_ERR(clk48m)) {
+			dev_err(dev, "cannot clk_get ocp2scp_usb_phy_phy_48m\n");
+			clk_put(phyclk);
+			iounmap(ctrl_base);
+			return PTR_ERR(clk48m);
+		}
 
-	clk32k = clk_get(dev, "usb_phy_cm_clk32k");
-	if (IS_ERR(clk32k)) {
-		dev_err(dev, "cannot clk_get usb_phy_cm_clk32k\n");
-		clk_put(phyclk);
-		clk_put(clk48m);
-		iounmap(ctrl_base);
-		return PTR_ERR(clk32k);
+		clk32k = clk_get(dev, "usb_phy_cm_clk32k");
+		if (IS_ERR(clk32k)) {
+			dev_err(dev, "cannot clk_get usb_phy_cm_clk32k\n");
+			clk_put(phyclk);
+			clk_put(clk48m);
+			iounmap(ctrl_base);
+			return PTR_ERR(clk32k);
+		}
 	}
 	return 0;
 }