summaryrefslogtreecommitdiffstats
path: root/drivers/iommu/iommufd/iova_bitmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/iommu/iommufd/iova_bitmap.c')
-rw-r--r--drivers/iommu/iommufd/iova_bitmap.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/iommu/iommufd/iova_bitmap.c b/drivers/iommu/iommufd/iova_bitmap.c
index db8c46bee1..e33ddfc239 100644
--- a/drivers/iommu/iommufd/iova_bitmap.c
+++ b/drivers/iommu/iommufd/iova_bitmap.c
@@ -384,8 +384,6 @@ static int iova_bitmap_advance(struct iova_bitmap *bitmap)
bitmap->mapped_base_index += count;
iova_bitmap_put(bitmap);
- if (iova_bitmap_done(bitmap))
- return 0;
/* Iterate, set and skip any bits requested for next iteration */
if (bitmap->set_ahead_length) {
@@ -396,6 +394,9 @@ static int iova_bitmap_advance(struct iova_bitmap *bitmap)
return ret;
}
+ if (iova_bitmap_done(bitmap))
+ return 0;
+
/* When advancing the index we pin the next set of bitmap pages */
return iova_bitmap_get(bitmap);
}