[PATCH v1 4/4] ACPI: glue: Skip devices with no type in acpi_device_notify()

Rafael J. Wysocki posted 1 patch 2 weeks ago
drivers/acpi/glue.c | 3 +++
1 file changed, 3 insertions(+)
[PATCH v1 4/4] ACPI: glue: Skip devices with no type in acpi_device_notify()
Posted by Rafael J. Wysocki 2 weeks ago
From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>

Since all of the users of struct acpi_bus_type use the device type
for matching, devices without a type will not be matched by any of
them, so they can be skipped early in acpi_device_notify().

Update the code accordingly.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/acpi/glue.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c
index 1981ebfb5ce0..c53f3d86254a 100644
--- a/drivers/acpi/glue.c
+++ b/drivers/acpi/glue.c
@@ -63,6 +63,9 @@ static struct acpi_device *acpi_companion_lookup(struct device *dev)
 {
 	struct acpi_bus_type *type;
 
+	if (!dev->type)
+		return NULL;
+
 	guard(rwsem_read)(&bus_type_sem);
 
 	list_for_each_entry(type, &bus_type_list, list) {
-- 
2.51.0