ACPI / bus: Remove checks in acpi_get_match_data()
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Fri, 9 Feb 2018 15:38:34 +0000 (17:38 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 12 Feb 2018 09:41:10 +0000 (10:41 +0100)
As well as its sibling of_device_get_match_data() has no such checks,
no need to do it in acpi_get_match_data().

First of all, we are not supposed to call fwnode API like this without
driver attached.

Second, since __acpi_match_device() does check input parameter there is
no need to duplicate it outside.

And last but not least one, the API should still serve the cases when
ACPI device is enumerated via PRP0001. In such case driver has neither
ACPI table nor driver data there.

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

index f1384e107eed515eb7330f597a7dfcbdd387b4c2..ca4af098b1bfb39f7d5857f4a65864f50ec71884 100644 (file)
@@ -834,12 +834,6 @@ void *acpi_get_match_data(const struct device *dev)
 {
        const struct acpi_device_id *match;
 
-       if (!dev->driver)
-               return NULL;
-
-       if (!dev->driver->acpi_match_table)
-               return NULL;
-
        match = acpi_match_device(dev->driver->acpi_match_table, dev);
        if (!match)
                return NULL;