Skip to contentSkip to conversation

bus: omap-ocp2scp: Fix error handling in omap_ocp2scp_probe

PATCH Superseded Kishon Vijay Abraham I 2 participants 4 messages May 19, 2017 – Jul 11, 2017 OMAP2+ support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bus: omap-ocp2scp: Fix error handling in omap_ocp2scp_probe

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.

---
 drivers/bus/omap-ocp2scp.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/bus/omap-ocp2scp.c +7 -2
index bf500e0e7362..77791f3dcfc6 100644
@@ -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);
 
Signature · 1 line
2.11.0
#1 lore raw

+Tony, Arnd,

Hi,

Quoted 3 lines · Kishon Vijay Abraham I

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.

Can this patch be picked into arm-soc tree?

Thanks
Kishon

Quoted 35 lines
---
 drivers/bus/omap-ocp2scp.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/bus/omap-ocp2scp.c +7 -2
index bf500e0e7362..77791f3dcfc6 100644
@@ -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);
 
maintainer
#2 lore raw
Quoted 10 lines · Kishon Vijay Abraham I

+Tony, Arnd,

Hi,

Quoted 3 lines · Kishon Vijay Abraham I

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.

Can this patch be picked into arm-soc tree?

Yes can you please resend? I don't seem to have it in my inbox.

Regards,

Tony

#3 lore raw

Tony,

Quoted 5 lines · Tony Lindgren
Quoted 4 lines · Kishon Vijay Abraham I

+Tony, Arnd,

Hi,

Quoted 8 lines
Quoted 6 lines · Kishon Vijay Abraham I
Quoted 3 lines

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.

Can this patch be picked into arm-soc tree?

Yes can you please resend? I don't seem to have it in my inbox.

re-sent now.

Thanks
Kishon