summaryrefslogtreecommitdiffstats
path: root/drivers/iommu/exynos-iommu.c
diff options
context:
space:
mode:
authorMarek Szyprowski <m.szyprowski@samsung.com>2015-05-19 15:20:32 +0200
committerJoerg Roedel <jroedel@suse.de>2015-05-29 10:49:43 +0200
commit06801db0d3bba2b4e585130981fadf71bbce4159 (patch)
treecaf45baa2e7184da495ad5a51b50316c13e9523f /drivers/iommu/exynos-iommu.c
parentiommu/exynos: Document internal structures (diff)
downloadlinux-06801db0d3bba2b4e585130981fadf71bbce4159.tar.xz
linux-06801db0d3bba2b4e585130981fadf71bbce4159.zip
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 <m.szyprowski@samsung.com> Tested-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu/exynos-iommu.c')
-rw-r--r--drivers/iommu/exynos-iommu.c6
1 files changed, 6 insertions, 0 deletions
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);
}