Skip to content

Commit 34678c9

Browse files
ij-intelgregkh
authored andcommitted
PCI: Use res_to_dev_res() in reassign_resources_sorted()
[ Upstream commit 4bee4fc ] 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 Stable-dep-of: 1ee4716 ("PCI: Fix premature removal from realloc_head list during resource assignment") Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent f176c47 commit 34678c9

1 file changed

Lines changed: 1 addition & 10 deletions

File tree

drivers/pci/setup-bus.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -417,16 +417,13 @@ static void reassign_resources_sorted(struct list_head *realloc_head,
417417
struct list_head *head)
418418
{
419419
struct pci_dev_resource *add_res, *tmp;
420-
struct pci_dev_resource *dev_res;
421420
struct pci_dev *dev;
422421
struct resource *res;
423422
const char *res_name;
424423
resource_size_t add_size, align;
425424
int idx;
426425

427426
list_for_each_entry_safe(add_res, tmp, realloc_head, list) {
428-
bool found_match = false;
429-
430427
res = add_res->res;
431428
dev = add_res->dev;
432429
idx = pci_resource_num(dev, res);
@@ -440,13 +437,7 @@ static void reassign_resources_sorted(struct list_head *realloc_head,
440437
goto out;
441438

442439
/* Skip this resource if not found in head list */
443-
list_for_each_entry(dev_res, head, list) {
444-
if (dev_res->res == res) {
445-
found_match = true;
446-
break;
447-
}
448-
}
449-
if (!found_match) /* Just skip */
440+
if (!res_to_dev_res(head, res))
450441
continue;
451442

452443
res_name = pci_resource_name(dev, idx);

0 commit comments

Comments
 (0)