summaryrefslogtreecommitdiffstats
path: root/drivers/iommu
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/iommu')
-rw-r--r--drivers/iommu/amd_iommu.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index 9dc7facfd2e5..3c1a29104f0e 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -3682,13 +3682,12 @@ static int alloc_irq_index(u16 devid, int count, bool align)
/* Scan table for free entries */
for (index = ALIGN(table->min_index, alignment), c = 0;
- index < MAX_IRQS_PER_TABLE;
- index++) {
+ index < MAX_IRQS_PER_TABLE;) {
if (!iommu->irte_ops->is_allocated(table, index)) {
c += 1;
} else {
c = 0;
- index = ALIGN(index, alignment);
+ index = ALIGN(index + 1, alignment);
continue;
}
@@ -3699,6 +3698,8 @@ static int alloc_irq_index(u16 devid, int count, bool align)
index -= count - 1;
goto out;
}
+
+ index++;
}
index = -ENOSPC;