aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYongji Xie <elohimes@gmail.com>2017-04-10 07:58:11 -0400
committerBjorn Helgaas <bhelgaas@google.com>2017-04-18 15:47:20 -0400
commitc9c75143a5962c4c26d2f2c99b7a6e06f421f5e1 (patch)
tree55bd5389c0e603b900ce7fcc317fbae2575543bb
parentea629d873f3e140fb2e3181c30413e485ee9002b (diff)
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 <elohimes@gmail.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
-rw-r--r--drivers/pci/setup-bus.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index cb389277df41..958da7db9033 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -1066,10 +1066,10 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask,
1066 r->flags = 0; 1066 r->flags = 0;
1067 continue; 1067 continue;
1068 } 1068 }
1069 size += r_size; 1069 size += max(r_size, align);
1070 /* Exclude ranges with size > align from 1070 /* Exclude ranges with size > align from
1071 calculation of the alignment. */ 1071 calculation of the alignment. */
1072 if (r_size == align) 1072 if (r_size <= align)
1073 aligns[order] += align; 1073 aligns[order] += align;
1074 if (order > max_order) 1074 if (order > max_order)
1075 max_order = order; 1075 max_order = order;