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

Configure Feed

Select the types of activity you want to include in your feed.

PCI: Use res_to_dev_res() in reassign_resources_sorted()

reassign_resources_sorted() contains a search loop for a particular
resource in the head list. res_to_dev_res() already implements the same
search so use it instead.

Drop unused found_match and dev_res variables.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Link: https://patch.msgid.link/20251219174036.16738-9-ilpo.jarvinen@linux.intel.com

authored by

Ilpo Järvinen and committed by
Bjorn Helgaas
4bee4fc0 5819403a

+1 -10
+1 -10
drivers/pci/setup-bus.c
··· 414 414 struct list_head *head) 415 415 { 416 416 struct pci_dev_resource *add_res, *tmp; 417 - struct pci_dev_resource *dev_res; 418 417 struct pci_dev *dev; 419 418 struct resource *res; 420 419 const char *res_name; ··· 421 422 int idx; 422 423 423 424 list_for_each_entry_safe(add_res, tmp, realloc_head, list) { 424 - bool found_match = false; 425 - 426 425 res = add_res->res; 427 426 dev = add_res->dev; 428 427 idx = pci_resource_num(dev, res); ··· 434 437 goto out; 435 438 436 439 /* Skip this resource if not found in head list */ 437 - list_for_each_entry(dev_res, head, list) { 438 - if (dev_res->res == res) { 439 - found_match = true; 440 - break; 441 - } 442 - } 443 - if (!found_match) /* Just skip */ 440 + if (!res_to_dev_res(head, res)) 444 441 continue; 445 442 446 443 res_name = pci_resource_name(dev, idx);