diff mbox series

[7/7] usb: bdc: Use devm_clk_get_optional()

Message ID 20200717152307.36705-8-alcooperx@gmail.com (mailing list archive)
State Superseded
Headers show
Series usb: bdc: Updates and fixes to the USB BDC driver | expand

Commit Message

Alan Cooper July 17, 2020, 3:23 p.m. UTC
From: Florian Fainelli <florian.fainelli@broadcom.com>

The BDC clock is optional and we may get an -EPROBE_DEFER error code
which would not be propagated correctly, fix this by using
devm_clk_get_optional().

Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
 drivers/usb/gadget/udc/bdc/bdc_core.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Comments

Florian Fainelli July 17, 2020, 4:57 p.m. UTC | #1
On 7/17/2020 8:23 AM, Al Cooper wrote:
> From: Florian Fainelli <florian.fainelli@broadcom.com>
> 
> The BDC clock is optional and we may get an -EPROBE_DEFER error code
> which would not be propagated correctly, fix this by using
> devm_clk_get_optional().
> 
> Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>

Since you are carrying this patch on my behalf your Signed-off-by should
also be present, if you don't mind, I would like my gmail.com address to
be used here for consistency with all submissions done throughout my
tenure at broadcom, thanks!
diff mbox series

Patch

diff --git a/drivers/usb/gadget/udc/bdc/bdc_core.c b/drivers/usb/gadget/udc/bdc/bdc_core.c
index ac989adefe9d..5d8bd9129365 100644
--- a/drivers/usb/gadget/udc/bdc/bdc_core.c
+++ b/drivers/usb/gadget/udc/bdc/bdc_core.c
@@ -497,11 +497,9 @@  static int bdc_probe(struct platform_device *pdev)
 
 	dev_dbg(dev, "%s()\n", __func__);
 
-	clk = devm_clk_get(dev, "sw_usbd");
-	if (IS_ERR(clk)) {
-		dev_info(dev, "Clock not found in Device Tree\n");
-		clk = NULL;
-	}
+	clk = devm_clk_get_optional(dev, "sw_usbd");
+	if (IS_ERR(clk))
+		return PTR_ERR(clk);
 
 	ret = clk_prepare_enable(clk);
 	if (ret) {