lkml.org 
[lkml]   [2018]   [Aug]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] PCI: Fix calculation of bridge window's size
Date
There are some 0 resource size pci devices, and it leads to the
accumulator fails to maintain the correct value.
It results in a strange issue on my machine that xhci_hcd failed to init.
[ 2.437278] xhci_hcd 0000:05:00.0: init 0000:05:00.0 fail, -16
[ 2.437300] xhci_hcd: probe of 0000:05:00.0 failed with error -16

To fix this, check if the resource size equals to 0, doesn't increase size.

Fixes: c9c75143a596 ("PCI: Fix calculation of bridge window's size and alignment")
CC: stable@vger.kernel.org # 4.14+

Signed-off-by: AceLan Kao <acelan.kao@canonical.com>
---
drivers/pci/setup-bus.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index 79b1824e83b4..ae05dde8c6e3 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -1061,7 +1061,8 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask,
r->flags = 0;
continue;
}
- size += max(r_size, align);
+ if (r_size != 0)
+ size += max(r_size, align);
/* Exclude ranges with size > align from
calculation of the alignment. */
if (r_size <= align)
--
2.17.1
\
 
 \ /
  Last update: 2018-08-08 07:49    [W:0.033 / U:6.372 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site