OSDN Git Service

usb: bdc: Use devm_clk_get_optional()
authorFlorian Fainelli <f.fainelli@gmail.com>
Wed, 22 Jul 2020 17:07:46 +0000 (13:07 -0400)
committerFelipe Balbi <balbi@kernel.org>
Fri, 24 Jul 2020 13:45:15 +0000 (16:45 +0300)
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 <f.fainelli@gmail.com>
Signed-off-by: Al Cooper <alcooperx@gmail.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
drivers/usb/gadget/udc/bdc/bdc_core.c

index 0f1617e..5ff3652 100644 (file)
@@ -493,11 +493,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) {