PCI: When removing bus, always remove legacy files & unregister
authorJiang Liu <liuj97@gmail.com>
Fri, 12 Apr 2013 05:44:15 +0000 (05:44 +0000)
committerBjorn Helgaas <bhelgaas@google.com>
Fri, 12 Apr 2013 20:57:02 +0000 (14:57 -0600)
We always call device_register() and pci_create_legacy_files() for a
new bus before handing out the "struct pci_bus *".  Therefore, there's
no possiblity of removing the bus with pci_remove_bus() before those
calls have been made, so we don't need to check "bus->is_added" before
calling pci_remove_legacy_files() and device_unregister().

[bhelgaas: changelog]
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Signed-off-by: Yijing Wang <wangyijing@huawei.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Yinghai Lu <yinghai@kernel.org>
Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Cc: Toshi Kani <toshi.kani@hp.com>
drivers/pci/remove.c

index cc875e6ed159f1edb890946a96e78917bb6fe2c5..a8318801c092581716b2e5881d0fc31ff2340f53 100644 (file)
@@ -50,9 +50,6 @@ void pci_remove_bus(struct pci_bus *bus)
        list_del(&bus->node);
        pci_bus_release_busn_res(bus);
        up_write(&pci_bus_sem);
-       if (!bus->is_added)
-               return;
-
        pci_remove_legacy_files(bus);
        device_unregister(&bus->dev);
 }