summaryrefslogtreecommitdiffstats
path: root/drivers/acpi/tables.c
diff options
context:
space:
mode:
authorAl Stone <ahs3@redhat.com>2016-08-19 18:48:11 -0600
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2016-08-31 01:21:48 +0200
commitfa162a05de280e7e62f30eac4dc591e8f5052483 (patch)
treead6dfe75412a6fb0ca0c55da6076436d81708196 /drivers/acpi/tables.c
parent3eab887a55424fc2c27553b7bfe32330df83f7b8 (diff)
downloadlinux-fa162a05de280e7e62f30eac4dc591e8f5052483.tar.bz2
ACPI / tables: fix incorrect counts returned by acpi_parse_entries_array()
The static function acpi_parse_entries_array() is provided an array of type struct acpi_subtable_proc that has a callback function and a count. The count should reflect how many times the callback has been called. However, the current code only increments the 0th element of the array, regardless of the number of entries in the array, or which callback has been invoked. The result is that we know the total number of callbacks made but we cannot determine which callbacks were made, nor how often. The fix is to index into the array of structs and increment the proper counts. There is one place in the x86 code for acpi_parse_madt_lapic_entries() where the counts for each callback are used. If no LAPICs *and* no X2APICs are found, an ENODEV is supposed to be returned; as it stands, the count of X2APICs will always be zero, regardless of what is in the MADT. Should there be no LAPICs, ENODEV will be returned in error, if there are X2APICs in the MADT. Otherwise, there are no other functional consequences of the count being done as it currently is; all other uses simply check that the return value from acpi_parse_entries_array() or passed back via its callers is either non-zero, an error, or in one case just ignored. In future patches, I will also need these counts to be correct; I need to count the number of instances of subtables of certain types within the MADT to determine whether or not an ACPI IORT is required or not, and report when it is not present when it should be. Signed-off-by: Al Stone <ahs3@redhat.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi/tables.c')
-rw-r--r--drivers/acpi/tables.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c
index 9f0ad6ebb368..bf273c70977a 100644
--- a/drivers/acpi/tables.c
+++ b/drivers/acpi/tables.c
@@ -281,7 +281,7 @@ acpi_parse_entries_array(char *id, unsigned long table_size,
proc[i].handler(entry, table_end))
return -EINVAL;
- proc->count++;
+ proc[i].count++;
break;
}
if (i != proc_num)