diff options
Diffstat (limited to 'lib/fw_table.c')
-rw-r--r-- | lib/fw_table.c | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/lib/fw_table.c b/lib/fw_table.c index 1e5e0b2f70120..c3569d2ba503f 100644 --- a/lib/fw_table.c +++ b/lib/fw_table.c @@ -111,11 +111,6 @@ acpi_table_get_length(enum acpi_subtable_type type, return header->acpi.length; } -static __init_or_fwtbl_lib bool has_handler(struct acpi_subtable_proc *proc) -{ - return proc->handler || proc->handler_arg; -} - static __init_or_fwtbl_lib int call_handler(struct acpi_subtable_proc *proc, union acpi_subtable_headers *hdr, unsigned long end) @@ -160,7 +155,6 @@ acpi_parse_entries_array(char *id, unsigned long table_size, struct acpi_subtable_entry entry; enum acpi_subtable_type type; int count = 0; - int errs = 0; int i; type = acpi_get_subtable_type(id); @@ -174,25 +168,19 @@ acpi_parse_entries_array(char *id, unsigned long table_size, ((unsigned long)table_header + table_size); subtable_len = acpi_get_subtable_header_length(&entry); - while (((unsigned long)entry.hdr) + subtable_len < table_end) { - if (max_entries && count >= max_entries) - break; - + while (((unsigned long)entry.hdr) + subtable_len < table_end) { for (i = 0; i < proc_num; i++) { if (acpi_get_entry_type(&entry) != proc[i].id) continue; - if (!has_handler(&proc[i]) || - (!errs && - call_handler(&proc[i], entry.hdr, table_end))) { - errs++; - continue; - } + + if (!max_entries || count < max_entries) + if (call_handler(&proc[i], entry.hdr, table_end)) + return -EINVAL; proc[i].count++; + count++; break; } - if (i != proc_num) - count++; /* * If entry->length is 0, break from this loop to avoid @@ -209,11 +197,11 @@ acpi_parse_entries_array(char *id, unsigned long table_size, } if (max_entries && count > max_entries) { - pr_warn("[%4.4s:0x%02x] found the maximum %i entries\n", - id, proc->id, count); + pr_warn("[%4.4s:0x%02x] ignored %i entries of %i found\n", + id, proc->id, count - max_entries, count); } - return errs ? -EINVAL : count; + return count; } int __init_or_fwtbl_lib |