Skip to content

Commit

Permalink
iommu/exynos: Handle failed IOMMU device registration properly
Browse files Browse the repository at this point in the history
[ Upstream commit fce398d ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Sam Protsenko authored and gregkh committed Aug 17, 2022
1 parent 9a06340 commit 79f1a94
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/iommu/exynos-iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ static int exynos_sysmmu_probe(struct platform_device *pdev)

ret = iommu_device_register(&data->iommu, &exynos_iommu_ops, dev);
if (ret)
return ret;
goto err_iommu_register;

platform_set_drvdata(pdev, data);

Expand All @@ -657,6 +657,10 @@ static int exynos_sysmmu_probe(struct platform_device *pdev)
pm_runtime_enable(dev);

return 0;

err_iommu_register:
iommu_device_sysfs_remove(&data->iommu);
return ret;
}

static int __maybe_unused exynos_sysmmu_suspend(struct device *dev)
Expand Down

0 comments on commit 79f1a94

Please sign in to comment.