diff mbox series

[v2,2/7] ACPI / LPSS: Make hid_uid_match helper accept a NULL uid argument

Message ID 20180923135812.29574-3-hdegoede@redhat.com (mailing list archive)
State Accepted, archived
Delegated to: Rafael Wysocki
Headers show
Series Resume BYT/CHT LPSS I2C controller before the iGPU | expand

Commit Message

Hans de Goede Sept. 23, 2018, 1:58 p.m. UTC
Make hid_uid_match helper accept a NULL uid argument, so that we can also
check for matches against devices with are not expected to have a uid such
as the LNXVIDEO device.

Tested-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/acpi/acpi_lpss.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c
index 125ef7db86ff..73ae43627d60 100644
--- a/drivers/acpi/acpi_lpss.c
+++ b/drivers/acpi/acpi_lpss.c
@@ -479,7 +479,13 @@  static bool hid_uid_match(struct acpi_device *adev,
 	const char *hid1 = acpi_device_hid(adev);
 	const char *uid1 = acpi_device_uid(adev);
 
-	return !strcmp(hid1, hid2) && uid1 && uid2 && !strcmp(uid1, uid2);
+	if (strcmp(hid1, hid2))
+		return false;
+
+	if (!uid2)
+		return true;
+
+	return uid1 && !strcmp(uid1, uid2);
 }
 
 static bool acpi_lpss_is_supplier(struct acpi_device *adev,