iommu/dmar: Return directly from a loop in dmar_dev_scope_status()

There is no need to have a temporary variable.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
This commit is contained in:
Andy Shevchenko 2017-03-16 16:23:52 +02:00 committed by Joerg Roedel
parent 8326c5d205
commit 4a8ed2b819
1 changed files with 8 additions and 6 deletions

View File

@ -557,11 +557,10 @@ static int __init dmar_table_detect(void)
static int dmar_walk_remapping_entries(struct acpi_dmar_header *start, static int dmar_walk_remapping_entries(struct acpi_dmar_header *start,
size_t len, struct dmar_res_callback *cb) size_t len, struct dmar_res_callback *cb)
{ {
int ret = 0;
struct acpi_dmar_header *iter, *next; struct acpi_dmar_header *iter, *next;
struct acpi_dmar_header *end = ((void *)start) + len; struct acpi_dmar_header *end = ((void *)start) + len;
for (iter = start; iter < end && ret == 0; iter = next) { for (iter = start; iter < end; iter = next) {
next = (void *)iter + iter->length; next = (void *)iter + iter->length;
if (iter->length == 0) { if (iter->length == 0) {
/* Avoid looping forever on bad ACPI tables */ /* Avoid looping forever on bad ACPI tables */
@ -570,8 +569,7 @@ static int dmar_walk_remapping_entries(struct acpi_dmar_header *start,
} else if (next > end) { } else if (next > end) {
/* Avoid passing table end */ /* Avoid passing table end */
pr_warn(FW_BUG "Record passes table end\n"); pr_warn(FW_BUG "Record passes table end\n");
ret = -EINVAL; return -EINVAL;
break;
} }
if (cb->print_entry) if (cb->print_entry)
@ -582,15 +580,19 @@ static int dmar_walk_remapping_entries(struct acpi_dmar_header *start,
pr_debug("Unknown DMAR structure type %d\n", pr_debug("Unknown DMAR structure type %d\n",
iter->type); iter->type);
} else if (cb->cb[iter->type]) { } else if (cb->cb[iter->type]) {
int ret;
ret = cb->cb[iter->type](iter, cb->arg[iter->type]); ret = cb->cb[iter->type](iter, cb->arg[iter->type]);
if (ret)
return ret;
} else if (!cb->ignore_unhandled) { } else if (!cb->ignore_unhandled) {
pr_warn("No handler for DMAR structure type %d\n", pr_warn("No handler for DMAR structure type %d\n",
iter->type); iter->type);
ret = -EINVAL; return -EINVAL;
} }
} }
return ret; return 0;
} }
static inline int dmar_walk_dmar_table(struct acpi_table_dmar *dmar, static inline int dmar_walk_dmar_table(struct acpi_table_dmar *dmar,