iommu/exynos: Handle failed IOMMU device registration properly

[ Upstream commit fce398d2d02c0a9a2bedf7c7201b123e153e8963 ]

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: d2c302b6e8 ("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>
This commit is contained in:
Sam Protsenko 2022-07-14 19:55:46 +03:00 committed by Greg Kroah-Hartman
parent 59a1c084b0
commit 45eaf2b23c

View File

@ -640,7 +640,7 @@ static int __init exynos_sysmmu_probe(struct platform_device *pdev)
ret = iommu_device_register(&data->iommu); ret = iommu_device_register(&data->iommu);
if (ret) if (ret)
return ret; goto err_iommu_register;
platform_set_drvdata(pdev, data); platform_set_drvdata(pdev, data);
@ -667,6 +667,10 @@ static int __init exynos_sysmmu_probe(struct platform_device *pdev)
pm_runtime_enable(dev); pm_runtime_enable(dev);
return 0; return 0;
err_iommu_register:
iommu_device_sysfs_remove(&data->iommu);
return ret;
} }
static int __maybe_unused exynos_sysmmu_suspend(struct device *dev) static int __maybe_unused exynos_sysmmu_suspend(struct device *dev)