Skip to content

Commit 2649a0f

Browse files
andy-shevrafaeljw
authored andcommitted
ACPI: scan: Use list_first_entry_or_null() in acpi_device_hid()
To replace list_empty() + list_first_entry() pair to simplify code. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 3361530 commit 2649a0f

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/acpi/scan.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1298,10 +1298,10 @@ const char *acpi_device_hid(struct acpi_device *device)
12981298
{
12991299
struct acpi_hardware_id *hid;
13001300

1301-
if (list_empty(&device->pnp.ids))
1301+
hid = list_first_entry_or_null(&device->pnp.ids, struct acpi_hardware_id, list);
1302+
if (!hid)
13021303
return dummy_hid;
13031304

1304-
hid = list_first_entry(&device->pnp.ids, struct acpi_hardware_id, list);
13051305
return hid->id;
13061306
}
13071307
EXPORT_SYMBOL(acpi_device_hid);

0 commit comments

Comments
 (0)