diff options
-rw-r--r-- | drivers/pci/setup-bus.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index cb1a027eb552..0959430534b2 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c | |||
@@ -299,8 +299,17 @@ static struct resource *find_free_bus_resource(struct pci_bus *bus, unsigned lon | |||
299 | r = bus->resource[i]; | 299 | r = bus->resource[i]; |
300 | if (r == &ioport_resource || r == &iomem_resource) | 300 | if (r == &ioport_resource || r == &iomem_resource) |
301 | continue; | 301 | continue; |
302 | if (r && (r->flags & type_mask) == type && !r->parent) | 302 | if (r && (r->flags & type_mask) == type) { |
303 | return r; | 303 | if (!r->parent) |
304 | return r; | ||
305 | /* | ||
306 | * if there is no child under that, we should release | ||
307 | * and use it. don't need to reset it, pbus_size_* will | ||
308 | * set it again | ||
309 | */ | ||
310 | if (!r->child && !release_resource(r)) | ||
311 | return r; | ||
312 | } | ||
304 | } | 313 | } |
305 | return NULL; | 314 | return NULL; |
306 | } | 315 | } |