Commit 2b563134 authored by Yu Zhao's avatar Yu Zhao Committed by Jesse Barnes

PCI: check if a bus is added when removing it

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: default avatarYu Zhao <yu.zhao@intel.com>
Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
parent 11df1f05
...@@ -71,6 +71,9 @@ void pci_remove_bus(struct pci_bus *pci_bus) ...@@ -71,6 +71,9 @@ void pci_remove_bus(struct pci_bus *pci_bus)
down_write(&pci_bus_sem); down_write(&pci_bus_sem);
list_del(&pci_bus->node); list_del(&pci_bus->node);
up_write(&pci_bus_sem); up_write(&pci_bus_sem);
if (!pci_bus->is_added)
return;
pci_remove_legacy_files(pci_bus); pci_remove_legacy_files(pci_bus);
device_remove_file(&pci_bus->dev, &dev_attr_cpuaffinity); device_remove_file(&pci_bus->dev, &dev_attr_cpuaffinity);
device_remove_file(&pci_bus->dev, &dev_attr_cpulistaffinity); device_remove_file(&pci_bus->dev, &dev_attr_cpulistaffinity);
......
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