diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c index 3cef835b375fd6a6adaacd1384987a5f905e9c46..83ae838ceb5f0a3ea93750ea51568eb83bd91764 100644 --- a/drivers/pci/bus.c +++ b/drivers/pci/bus.c @@ -197,6 +197,10 @@ static int pci_bus_alloc_from_region(struct pci_bus *bus, struct resource *res, max = avail.end; + /* Don't bother if available space isn't large enough */ + if (size > max - min_used + 1) + continue; + /* Ok, try it out.. */ ret = allocate_resource(r, res, size, min_used, max, align, alignf, alignf_data);