In commit d74b9027a4da(PCI: Consider additional PF's IOV BAR alignment in sizing and assigning), it stores additional alignment in realloc_head and take this into consideration for assignment. After getting the additional alignment, it will re-order the head list to make sure resources with bigger alignment is ahead of the resources with smaller assignment in the head list. To make it happen, it iterate on the head list and find a smaller alignment resource and insert ahead of it. This should be done for the first occurrence, while the code now will iterate on the whole list. This patch fixes this behavior by break when finding the first smaller resource in the head list. Signed-off-by: Wei Yang <weiyang@xxxxxxxxxxxxxxxxxx> --- drivers/pci/setup-bus.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index 4fd0cac..aa281d9 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c @@ -435,9 +435,11 @@ static void __assign_resources_sorted(struct list_head *head, list_for_each_entry(dev_res2, head, list) { align = pci_resource_alignment(dev_res2->dev, dev_res2->res); - if (add_align > align) + if (add_align > align) { list_move_tail(&dev_res->list, &dev_res2->list); + break; + } } } -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html