Commit 4a8ed2b8 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Joerg Roedel

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

There is no need to have a temporary variable.
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
parent 8326c5d2
...@@ -557,11 +557,10 @@ static int __init dmar_table_detect(void) ...@@ -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, ...@@ -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, ...@@ -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,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment