summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 142650e82979..f445c10df8df 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;
}