aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iommu/iommu.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/iommu/iommu.c')
-rw-r--r--drivers/iommu/iommu.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 4920605892a3..656b9499e748 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -1063,6 +1063,9 @@ int iommu_map(struct iommu_domain *domain, unsigned long iova,
1063 domain->ops->pgsize_bitmap == 0UL)) 1063 domain->ops->pgsize_bitmap == 0UL))
1064 return -ENODEV; 1064 return -ENODEV;
1065 1065
1066 if (unlikely(!(domain->type & __IOMMU_DOMAIN_PAGING)))
1067 return -EINVAL;
1068
1066 /* find out the minimum page size supported */ 1069 /* find out the minimum page size supported */
1067 min_pagesz = 1 << __ffs(domain->ops->pgsize_bitmap); 1070 min_pagesz = 1 << __ffs(domain->ops->pgsize_bitmap);
1068 1071
@@ -1114,6 +1117,9 @@ size_t iommu_unmap(struct iommu_domain *domain, unsigned long iova, size_t size)
1114 domain->ops->pgsize_bitmap == 0UL)) 1117 domain->ops->pgsize_bitmap == 0UL))
1115 return -ENODEV; 1118 return -ENODEV;
1116 1119
1120 if (unlikely(!(domain->type & __IOMMU_DOMAIN_PAGING)))
1121 return -EINVAL;
1122
1117 /* find out the minimum page size supported */ 1123 /* find out the minimum page size supported */
1118 min_pagesz = 1 << __ffs(domain->ops->pgsize_bitmap); 1124 min_pagesz = 1 << __ffs(domain->ops->pgsize_bitmap);
1119 1125