OSDN Git Service

ACPI / LPSS: Make hid_uid_match helper accept a NULL uid argument
authorHans de Goede <hdegoede@redhat.com>
Sun, 23 Sep 2018 13:58:07 +0000 (15:58 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Sun, 30 Sep 2018 20:38:24 +0000 (22:38 +0200)
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>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/acpi_lpss.c

index 125ef7d..73ae436 100644 (file)
@@ -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,