Merge tag 'tif-task_work.arch-2020-12-14' of git://git.kernel.dk/linux-block
[linux-2.6-microblaze.git] / drivers / phy / st / phy-stm32-usbphyc.c
index 2b3639c..a54317e 100644 (file)
@@ -311,7 +311,6 @@ static int stm32_usbphyc_probe(struct platform_device *pdev)
        struct stm32_usbphyc *usbphyc;
        struct device *dev = &pdev->dev;
        struct device_node *child, *np = dev->of_node;
-       struct resource *res;
        struct phy_provider *phy_provider;
        u32 version;
        int ret, port = 0;
@@ -322,17 +321,13 @@ static int stm32_usbphyc_probe(struct platform_device *pdev)
        usbphyc->dev = dev;
        dev_set_drvdata(dev, usbphyc);
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       usbphyc->base = devm_ioremap_resource(dev, res);
+       usbphyc->base = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(usbphyc->base))
                return PTR_ERR(usbphyc->base);
 
        usbphyc->clk = devm_clk_get(dev, NULL);
-       if (IS_ERR(usbphyc->clk)) {
-               ret = PTR_ERR(usbphyc->clk);
-               dev_err(dev, "clk get failed: %d\n", ret);
-               return ret;
-       }
+       if (IS_ERR(usbphyc->clk))
+               return dev_err_probe(dev, PTR_ERR(usbphyc->clk), "clk get_failed\n");
 
        ret = clk_prepare_enable(usbphyc->clk);
        if (ret) {
@@ -345,6 +340,10 @@ static int stm32_usbphyc_probe(struct platform_device *pdev)
                reset_control_assert(usbphyc->rst);
                udelay(2);
                reset_control_deassert(usbphyc->rst);
+       } else {
+               ret = PTR_ERR(usbphyc->rst);
+               if (ret == -EPROBE_DEFER)
+                       goto clk_disable;
        }
 
        usbphyc->switch_setup = -EINVAL;