iommu/exynos: Add/remove callbacks should fail if no iommu is available
authorMarek Szyprowski <m.szyprowski@samsung.com>
Tue, 19 May 2015 13:20:32 +0000 (15:20 +0200)
committerJoerg Roedel <jroedel@suse.de>
Fri, 29 May 2015 08:49:43 +0000 (10:49 +0200)
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 <m.szyprowski@samsung.com>
Tested-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/exynos-iommu.c

index f6ed59cad90b54b290046b5a493bad3ce0a892ce..99ed39c89e0b5be59d6bfd672dbc7df7a3f218dd 100644 (file)
@@ -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);
 }