summaryrefslogtreecommitdiffstats
path: root/drivers/iommu
diff options
context:
space:
mode:
authorDavid Woodhouse <David.Woodhouse@intel.com>2014-04-01 14:58:36 +0100
committerDavid Woodhouse <David.Woodhouse@intel.com>2014-04-01 14:58:38 +0100
commit7713ec066ae8adc49dd8daa02a73e6b60af6ee5f (patch)
treeeb824019a51e154555eac234062393d17d66aa59 /drivers/iommu
parent14d405699634d4ce0adfc7b4f52ac7427220a98d (diff)
iommu/vt-d: Fix error handling in ANDD processing
If we failed to find an ACPI device to correspond to an ANDD record, we would fail to increment our pointer and would just process the same record over and over again, with predictable results. Turn it from a while() loop into a for() loop to let the 'continue' in the error paths work correctly. Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/iommu')
-rw-r--r--drivers/iommu/dmar.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c
index 142650e8297..f445c10df8d 100644
--- a/drivers/iommu/dmar.c
+++ b/drivers/iommu/dmar.c
@@ -662,10 +662,9 @@ static int __init dmar_acpi_dev_scope_init(void)
if (dmar_tbl == NULL)
return -ENODEV;
- andd = (void *)dmar_tbl + sizeof(struct acpi_table_dmar);
-
- while (((unsigned long)andd) <
- ((unsigned long)dmar_tbl) + dmar_tbl->length) {
+ for (andd = (void *)dmar_tbl + sizeof(struct acpi_table_dmar);
+ ((unsigned long)andd) < ((unsigned long)dmar_tbl) + dmar_tbl->length;
+ andd = ((void *)andd) + andd->header.length) {
if (andd->header.type == ACPI_DMAR_TYPE_ANDD) {
acpi_handle h;
struct acpi_device *adev;
@@ -685,7 +684,6 @@ static int __init dmar_acpi_dev_scope_init(void)
}
dmar_acpi_insert_dev_scope(andd->device_number, adev);
}
- andd = ((void *)andd) + andd->header.length;
}
return 0;
}