Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ACPI: tables: Remove the duplicated checks for acpi_parse_entries_array()

acpi_disabled, pointer id and table_header are checked in
acpi_table_parse_entries_array(), and acpi_parse_entries_array() is
only called by acpi_table_parse_entries_array(), so those checks in
acpi_parse_entries_array() are duplicate.

Remove those duplicated checks and move the table_size check to
acpi_table_parse_entries_array() as well.

Signed-off-by: Hanjun Guo <guohanjun@huawei.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Hanjun Guo and committed by
Rafael J. Wysocki
24194a7e 2229a12b

+3 -14
+3 -14
drivers/acpi/tables.c
··· 292 292 int errs = 0; 293 293 int i; 294 294 295 - if (acpi_disabled) 296 - return -ENODEV; 297 - 298 - if (!id) 299 - return -EINVAL; 300 - 301 - if (!table_size) 302 - return -EINVAL; 303 - 304 - if (!table_header) { 305 - pr_warn("%4.4s not present\n", id); 306 - return -ENODEV; 307 - } 308 - 309 295 table_end = (unsigned long)table_header + table_header->length; 310 296 311 297 /* Parse all entries looking for a match. */ ··· 355 369 return -ENODEV; 356 370 357 371 if (!id) 372 + return -EINVAL; 373 + 374 + if (!table_size) 358 375 return -EINVAL; 359 376 360 377 if (!strncmp(id, ACPI_SIG_MADT, 4))