Skip to content

Commit ec01468

Browse files
ccl0vejoergroedel
authored andcommitted
iommu/rockchip: Fix unwind goto issue
Smatch complains that drivers/iommu/rockchip-iommu.c:1306 rk_iommu_probe() warn: missing unwind goto? The rk_iommu_probe function, after obtaining the irq value through platform_get_irq, directly returns an error if the returned value is negative, without releasing any resources. Fix this by adding a new error handling label "err_pm_disable" and use a goto statement to redirect to the error handling process. In order to preserve the original semantics, set err to the value of irq. Fixes: 1aa55ca ("iommu/rockchip: Move irq request past pm_runtime_enable") Signed-off-by: Chao Wang <[email protected]> Reviewed-by: Dongliang Mu <[email protected]> Reviewed-by: Heiko Stuebner <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent e332003 commit ec01468

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

drivers/iommu/rockchip-iommu.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1335,20 +1335,22 @@ static int rk_iommu_probe(struct platform_device *pdev)
13351335
for (i = 0; i < iommu->num_irq; i++) {
13361336
int irq = platform_get_irq(pdev, i);
13371337

1338-
if (irq < 0)
1339-
return irq;
1338+
if (irq < 0) {
1339+
err = irq;
1340+
goto err_pm_disable;
1341+
}
13401342

13411343
err = devm_request_irq(iommu->dev, irq, rk_iommu_irq,
13421344
IRQF_SHARED, dev_name(dev), iommu);
1343-
if (err) {
1344-
pm_runtime_disable(dev);
1345-
goto err_remove_sysfs;
1346-
}
1345+
if (err)
1346+
goto err_pm_disable;
13471347
}
13481348

13491349
dma_set_mask_and_coherent(dev, rk_ops->dma_bit_mask);
13501350

13511351
return 0;
1352+
err_pm_disable:
1353+
pm_runtime_disable(dev);
13521354
err_remove_sysfs:
13531355
iommu_device_sysfs_remove(&iommu->iommu);
13541356
err_put_group:

0 commit comments

Comments
 (0)