iommu: rockchip: Fix missing unwind goto in rk_iommu_probe()

Message ID 20230317072515.2924468-1-harshit.m.mogalapalli@oracle.com
State New
Headers
Series iommu: rockchip: Fix missing unwind goto in rk_iommu_probe() |

Commit Message

Harshit Mogalapalli March 17, 2023, 7:25 a.m. UTC
  Smatch reports:
	drivers/iommu/rockchip-iommu.c:1306
	rk_iommu_probe() warn: missing unwind goto?

Smatch detects that when (irq < 0) we are directly returning without
doing the cleanup.

Fix this by adding a pm_runtime_disable(dev), and using correct goto
label 'err_remove_sysfs' instead of a direct return.

Fixes: 1aa55ca9b14a ("iommu/rockchip: Move irq request past pm_runtime_enable")
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
---
This is purely based on static analysis. Only compile tested.
---
 drivers/iommu/rockchip-iommu.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
  

Patch

diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c
index f30db22ea5d7..0751f2e757fd 100644
--- a/drivers/iommu/rockchip-iommu.c
+++ b/drivers/iommu/rockchip-iommu.c
@@ -1302,8 +1302,11 @@  static int rk_iommu_probe(struct platform_device *pdev)
 	for (i = 0; i < iommu->num_irq; i++) {
 		int irq = platform_get_irq(pdev, i);
 
-		if (irq < 0)
-			return irq;
+		if (irq < 0) {
+			pm_runtime_disable(dev);
+			err = irq;
+			goto err_remove_sysfs;
+		}
 
 		err = devm_request_irq(iommu->dev, irq, rk_iommu_irq,
 				       IRQF_SHARED, dev_name(dev), iommu);