From: Marek Szyprowski Date: Tue, 19 May 2015 13:20:32 +0000 (+0200) Subject: iommu/exynos: Add/remove callbacks should fail if no iommu is available X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=06801db0d3bba2b4e585130981fadf71bbce4159;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git iommu/exynos: Add/remove callbacks should fail if no iommu is available Return fail if given master device passed to add_device/remove_device callbacks doesn't has associated any sysmmu controller. Signed-off-by: Marek Szyprowski Tested-by: Javier Martinez Canillas Signed-off-by: Joerg Roedel --- diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index f6ed59cad90b..99ed39c89e0b 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -1082,6 +1082,9 @@ static int exynos_iommu_add_device(struct device *dev) struct iommu_group *group; int ret; + if (!has_sysmmu(dev)) + return -ENODEV; + group = iommu_group_get(dev); if (!group) { @@ -1100,6 +1103,9 @@ static int exynos_iommu_add_device(struct device *dev) static void exynos_iommu_remove_device(struct device *dev) { + if (!has_sysmmu(dev)) + return; + iommu_group_remove_device(dev); }