Skip to content

Commit fce398d

Browse files
Sam Protsenkojoergroedel
authored andcommitted
iommu/exynos: Handle failed IOMMU device registration properly
If iommu_device_register() fails in exynos_sysmmu_probe(), the previous calls have to be cleaned up. In this case, the iommu_device_sysfs_add() should be cleaned up, by calling its remove counterpart call. Fixes: d2c302b ("iommu/exynos: Make use of iommu_device_register interface") Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Acked-by: Marek Szyprowski <m.szyprowski@samsung.com> Link: https://lore.kernel.org/r/20220714165550.8884-3-semen.protsenko@linaro.org Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent bc0d9af commit fce398d

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

drivers/iommu/exynos-iommu.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ static int exynos_sysmmu_probe(struct platform_device *pdev)
629629

630630
ret = iommu_device_register(&data->iommu, &exynos_iommu_ops, dev);
631631
if (ret)
632-
return ret;
632+
goto err_iommu_register;
633633

634634
platform_set_drvdata(pdev, data);
635635

@@ -656,6 +656,10 @@ static int exynos_sysmmu_probe(struct platform_device *pdev)
656656
pm_runtime_enable(dev);
657657

658658
return 0;
659+
660+
err_iommu_register:
661+
iommu_device_sysfs_remove(&data->iommu);
662+
return ret;
659663
}
660664

661665
static int __maybe_unused exynos_sysmmu_suspend(struct device *dev)

0 commit comments

Comments
 (0)