bus: omap-ocp2scp: Fix error handling in omap_ocp2scp_probe
authorKishon Vijay Abraham I <kishon@ti.com>
Tue, 11 Jul 2017 10:16:38 +0000 (15:46 +0530)
committerTony Lindgren <tony@atomide.com>
Wed, 12 Jul 2017 09:25:41 +0000 (02:25 -0700)
The error handling code in omap_ocp2scp_probe fails to invoke
pm_runtime_disable and fails to initialize return value in
certain cases. Fix it here.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
drivers/bus/omap-ocp2scp.c

index bf500e0e7362baf72f7a4321e5fda55dc4355f9b..77791f3dcfc657f3537c6aca29c9a9488ff4949f 100644 (file)
@@ -70,8 +70,10 @@ static int omap_ocp2scp_probe(struct platform_device *pdev)
        if (!of_device_is_compatible(np, "ti,am437x-ocp2scp")) {
                res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
                regs = devm_ioremap_resource(&pdev->dev, res);
-               if (IS_ERR(regs))
-                       goto err0;
+               if (IS_ERR(regs)) {
+                       ret = PTR_ERR(regs);
+                       goto err1;
+               }
 
                pm_runtime_get_sync(&pdev->dev);
                reg = readl_relaxed(regs + OCP2SCP_TIMING);
@@ -83,6 +85,9 @@ static int omap_ocp2scp_probe(struct platform_device *pdev)
 
        return 0;
 
+err1:
+       pm_runtime_disable(&pdev->dev);
+
 err0:
        device_for_each_child(&pdev->dev, NULL, ocp2scp_remove_devices);