Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: typec: intel_pmc_mux: Deduplicate ACPI matching in probe

There is no need to call acpi_dev_present() followed by
acpi_dev_get_first_match_dev() as they both do the same
with only difference in the returning value. Instead,
call the latter and check its result.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20230102202933.15968-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Andy Shevchenko and committed by
Greg Kroah-Hartman
8b9c6ab1 c3194949

+4 -5
+4 -5
drivers/usb/typec/mux/intel_pmc_mux.c
··· 602 602 int ret; 603 603 604 604 for (dev_id = &iom_acpi_ids[0]; dev_id->id[0]; dev_id++) { 605 - if (acpi_dev_present(dev_id->id, NULL, -1)) { 606 - pmc->iom_port_status_offset = (u32)dev_id->driver_data; 607 - adev = acpi_dev_get_first_match_dev(dev_id->id, NULL, -1); 605 + adev = acpi_dev_get_first_match_dev(dev_id->id, NULL, -1); 606 + if (adev) 608 607 break; 609 - } 610 608 } 611 - 612 609 if (!adev) 613 610 return -ENODEV; 611 + 612 + pmc->iom_port_status_offset = (u32)dev_id->driver_data; 614 613 615 614 INIT_LIST_HEAD(&resource_list); 616 615 ret = acpi_dev_get_memory_resources(adev, &resource_list);