diff options
author | Christoph Biedl <linux-kernel.bfrz@manchmal.in-ulm.de> | 2015-12-23 10:51:57 -0500 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2016-01-06 16:37:55 -0500 |
commit | 3460baa620685c20f5ee19afb6d99d26150c382c (patch) | |
tree | c287d0ffcd0a33ac3268dbe20ba3d1b17a91000a | |
parent | 1ec218373b8ebda821aec00bb156a9c94fad9cd4 (diff) |
PCI: Fix minimum allocation address overwrite
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+
-rw-r--r-- | drivers/pci/bus.c | 6 |
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, | |||
140 | type_mask |= IORESOURCE_TYPE_BITS; | 140 | type_mask |= IORESOURCE_TYPE_BITS; |
141 | 141 | ||
142 | pci_bus_for_each_resource(bus, r, i) { | 142 | pci_bus_for_each_resource(bus, r, i) { |
143 | resource_size_t min_used = min; | ||
144 | |||
143 | if (!r) | 145 | if (!r) |
144 | continue; | 146 | continue; |
145 | 147 | ||
@@ -163,12 +165,12 @@ static int pci_bus_alloc_from_region(struct pci_bus *bus, struct resource *res, | |||
163 | * overrides "min". | 165 | * overrides "min". |
164 | */ | 166 | */ |
165 | if (avail.start) | 167 | if (avail.start) |
166 | min = avail.start; | 168 | min_used = avail.start; |
167 | 169 | ||
168 | max = avail.end; | 170 | max = avail.end; |
169 | 171 | ||
170 | /* Ok, try it out.. */ | 172 | /* Ok, try it out.. */ |
171 | ret = allocate_resource(r, res, size, min, max, | 173 | ret = allocate_resource(r, res, size, min_used, max, |
172 | align, alignf, alignf_data); | 174 | align, alignf, alignf_data); |
173 | if (ret == 0) | 175 | if (ret == 0) |
174 | return 0; | 176 | return 0; |