summaryrefslogtreecommitdiff
path: root/drivers/pci
diff options
context:
space:
mode:
authorChristoph Biedl <linux-kernel.bfrz@manchmal.in-ulm.de>2015-12-23 16:51:57 +0100
committerSasha Levin <sasha.levin@oracle.com>2016-02-03 14:01:43 -0500
commit24ab3b8e796248bfbdb8a80469b9811b5df39caa (patch)
treefb178ba9eafcec4f20476a001da47f078f5f9f0c /drivers/pci
parent67d0df37bf4235bc3aa1866571e74437cba33199 (diff)
PCI: Fix minimum allocation address overwrite
[ Upstream commit 3460baa620685c20f5ee19afb6d99d26150c382c ] Commit 36e097a8a297 ("PCI: Split out bridge window override of minimum allocation address") claimed to do no functional changes but unfortunately did: The "min" variable is altered. At least the AVM A1 PCMCIA adapter was no longer detected, breaking ISDN operation. Use a local copy of "min" to restore the previous behaviour. [bhelgaas: avoid gcc "?:" extension for portability and readability] Fixes: 36e097a8a297 ("PCI: Split out bridge window override of minimum allocation address") Signed-off-by: Christoph Biedl <linux-kernel.bfrz@manchmal.in-ulm.de> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> CC: stable@vger.kernel.org # v3.14+ Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/bus.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c
index d3346d23963b..89b3befc7155 100644
--- a/drivers/pci/bus.c
+++ b/drivers/pci/bus.c
@@ -140,6 +140,8 @@ static int pci_bus_alloc_from_region(struct pci_bus *bus, struct resource *res,
type_mask |= IORESOURCE_TYPE_BITS;
pci_bus_for_each_resource(bus, r, i) {
+ resource_size_t min_used = min;
+
if (!r)
continue;
@@ -163,12 +165,12 @@ static int pci_bus_alloc_from_region(struct pci_bus *bus, struct resource *res,
* overrides "min".
*/
if (avail.start)
- min = avail.start;
+ min_used = avail.start;
max = avail.end;
/* Ok, try it out.. */
- ret = allocate_resource(r, res, size, min, max,
+ ret = allocate_resource(r, res, size, min_used, max,
align, alignf, alignf_data);
if (ret == 0)
return 0;