[PATCH 08/12] usb: dwc2: gadget: Do not fail probe if there isn't a clock node

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Dinh Nguyen <dinguyen@xxxxxxxxxx>

Since the dwc2 hcd driver is currently not looking for a clock node during
init, we should not completely fail if there isn't a clock provided.
Add a check for a valid clock before calling clock functions.

Signed-off-by: Dinh Nguyen <dinguyen@xxxxxxxxxx>
---
 drivers/usb/dwc2/gadget.c |   15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index aa57d3e..9989c36 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -3228,16 +3228,15 @@ int dwc2_gadget_init(struct dwc2_hsotg *dwc2, int irq)
 		dwc2->s3c_hsotg->phy = phy;
 
 	dwc2->s3c_hsotg->clk = devm_clk_get(dev, "otg");
-	if (IS_ERR(dwc2->s3c_hsotg->clk)) {
-		dev_err(dev, "cannot get otg clock\n");
-		return PTR_ERR(dwc2->s3c_hsotg->clk);
-	}
+	if (IS_ERR(dwc2->s3c_hsotg->clk))
+		dev_warn(dev, "cannot get otg clock\n");
 
 	dwc2->gadget.max_speed = USB_SPEED_HIGH;
 	dwc2->gadget.ops = &s3c_hsotg_gadget_ops;
 	dwc2->gadget.name = dev_name(dev);
 
-	clk_prepare_enable(dwc2->s3c_hsotg->clk);
+	if (!IS_ERR(dwc2->s3c_hsotg->clk))
+		clk_prepare_enable(dwc2->s3c_hsotg->clk);
 
 	/* regulators */
 
@@ -3342,7 +3341,8 @@ err_ep_mem:
 err_supplies:
 	s3c_hsotg_phy_disable(dwc2);
 err_clk:
-	clk_disable_unprepare(dwc2->s3c_hsotg->clk);
+	if (!IS_ERR(dwc2->s3c_hsotg->clk))
+		clk_disable_unprepare(dwc2->s3c_hsotg->clk);
 
 	return ret;
 }
@@ -3365,7 +3365,8 @@ int s3c_hsotg_remove(struct dwc2_hsotg *dwc2)
 	s3c_hsotg_phy_disable(dwc2);
 	if (dwc2->s3c_hsotg->phy)
 		phy_exit(dwc2->s3c_hsotg->phy);
-	clk_disable_unprepare(dwc2->s3c_hsotg->clk);
+	if (!IS_ERR(dwc2->s3c_hsotg->clk))
+		clk_disable_unprepare(dwc2->s3c_hsotg->clk);
 
 	return 0;
 }
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux