2023-03-17 07:26:19

by Harshit Mogalapalli

[permalink] [raw]
Subject: [PATCH] iommu: rockchip: Fix missing unwind goto in rk_iommu_probe()

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 <[email protected]>
---
This is purely based on static analysis. Only compile tested.
---
drivers/iommu/rockchip-iommu.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

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);
--
2.38.1