Commit 37b11faa authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

[PATCH] PCI: remove large stack usage in pci_do_scan_bus()

parent 7f754cf4
...@@ -505,23 +505,30 @@ unsigned int __devinit pci_do_scan_bus(struct pci_bus *bus) ...@@ -505,23 +505,30 @@ unsigned int __devinit pci_do_scan_bus(struct pci_bus *bus)
{ {
unsigned int devfn, max, pass; unsigned int devfn, max, pass;
struct list_head *ln; struct list_head *ln;
struct pci_dev *dev, dev0; struct pci_dev *dev;
dev = kmalloc(sizeof(*dev), GFP_KERNEL);
if (!dev) {
printk(KERN_ERR "Out of memory in %s\n", __FUNCTION__);
return 0;
}
DBG("Scanning bus %02x\n", bus->number); DBG("Scanning bus %02x\n", bus->number);
max = bus->secondary; max = bus->secondary;
/* Create a device template */ /* Create a device template */
memset(&dev0, 0, sizeof(dev0)); memset(dev, 0, sizeof(*dev));
dev0.bus = bus; dev->bus = bus;
dev0.sysdata = bus->sysdata; dev->sysdata = bus->sysdata;
dev0.dev.parent = bus->dev; dev->dev.parent = bus->dev;
dev0.dev.bus = &pci_bus_type; dev->dev.bus = &pci_bus_type;
/* Go find them, Rover! */ /* Go find them, Rover! */
for (devfn = 0; devfn < 0x100; devfn += 8) { for (devfn = 0; devfn < 0x100; devfn += 8) {
dev0.devfn = devfn; dev->devfn = devfn;
pci_scan_slot(&dev0); pci_scan_slot(dev);
} }
kfree(dev);
/* /*
* After performing arch-dependent fixup of the bus, look behind * After performing arch-dependent fixup of the bus, look behind
......
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