ACPI / bus: Do not traverse through non-existed device table
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Fri, 9 Feb 2018 15:38:33 +0000 (17:38 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 12 Feb 2018 09:41:09 +0000 (10:41 +0100)
commit4222f38ca3b7ae30ace582077677cec8b88fac36
tree505249ffae6f4b77276b96a3f020aa9f64e3ffb1
parent7928b2cbe55b2a410a0f5c1f154610059c57b1b2
ACPI / bus: Do not traverse through non-existed device table

When __acpi_match_device() is called it would be possible to have
ACPI ID table a NULL pointer. To avoid potential dereference,
check for this before traverse.

While here, remove redundant 'else'.

Note, this patch implies a bit of refactoring acpi_of_match_device()
to return pointer to OF ID when matched followed by refactoring
__acpi_match_device() to return either ACPI or OF ID when matches.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/bus.c