PCI: check if a bus is added when removing it
authorYu Zhao <yu.zhao@intel.com>
Wed, 28 Jan 2009 10:27:21 +0000 (18:27 +0800)
committerJesse Barnes <jbarnes@hobbes.lan>
Fri, 20 Mar 2009 02:29:26 +0000 (19:29 -0700)
When removing a bus, 'is_added' should be checked to make sure the
bus has been successfully added by pci_bus_add_child() who will sets
'is_added'.

Signed-off-by: Yu Zhao <yu.zhao@intel.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
drivers/pci/remove.c

index 042e08924421bbd8d3c773a1ee40dfb50d9a2a1e..caf8e1eae45e5351a90727da2d2830c83bcce3ba 100644 (file)
@@ -71,6 +71,9 @@ void pci_remove_bus(struct pci_bus *pci_bus)
        down_write(&pci_bus_sem);
        list_del(&pci_bus->node);
        up_write(&pci_bus_sem);
+       if (!pci_bus->is_added)
+               return;
+
        pci_remove_legacy_files(pci_bus);
        device_remove_file(&pci_bus->dev, &dev_attr_cpuaffinity);
        device_remove_file(&pci_bus->dev, &dev_attr_cpulistaffinity);