Skip to content

Commit c9c7514

Browse files
YongjiXiebjorn-helgaas
authored andcommitted
PCI: Fix calculation of bridge window's size and alignment
In case that one device's alignment is greater than its size, we may get an incorrect size and alignment for its bus's memory window in pbus_size_mem(). Fix this case. Signed-off-by: Yongji Xie <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]>
1 parent ea629d8 commit c9c7514

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/pci/setup-bus.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,10 +1066,10 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask,
10661066
r->flags = 0;
10671067
continue;
10681068
}
1069-
size += r_size;
1069+
size += max(r_size, align);
10701070
/* Exclude ranges with size > align from
10711071
calculation of the alignment. */
1072-
if (r_size == align)
1072+
if (r_size <= align)
10731073
aligns[order] += align;
10741074
if (order > max_order)
10751075
max_order = order;

0 commit comments

Comments
 (0)