Commit af74f907 authored by Christoph Biedl's avatar Christoph Biedl Committed by Luis Henriques

PCI: Fix minimum allocation address overwrite

commit 3460baa6 upstream.

Commit 36e097a8 ("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: 36e097a8 ("PCI: Split out bridge window override of minimum allocation address")
Signed-off-by: default avatarChristoph Biedl <linux-kernel.bfrz@manchmal.in-ulm.de>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
parent 5ba9df21
...@@ -146,6 +146,8 @@ static int pci_bus_alloc_from_region(struct pci_bus *bus, struct resource *res, ...@@ -146,6 +146,8 @@ static int pci_bus_alloc_from_region(struct pci_bus *bus, struct resource *res,
type_mask |= IORESOURCE_TYPE_BITS; type_mask |= IORESOURCE_TYPE_BITS;
pci_bus_for_each_resource(bus, r, i) { pci_bus_for_each_resource(bus, r, i) {
resource_size_t min_used = min;
if (!r) if (!r)
continue; continue;
...@@ -169,12 +171,12 @@ static int pci_bus_alloc_from_region(struct pci_bus *bus, struct resource *res, ...@@ -169,12 +171,12 @@ static int pci_bus_alloc_from_region(struct pci_bus *bus, struct resource *res,
* overrides "min". * overrides "min".
*/ */
if (avail.start) if (avail.start)
min = avail.start; min_used = avail.start;
max = avail.end; max = avail.end;
/* Ok, try it out.. */ /* 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); align, alignf, alignf_data);
if (ret == 0) if (ret == 0)
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment