The is_added flag in struct pci_bus is always set after invoking device_register() and pci_create_legacy_files(). The related code paths are: 1) pci_create_root_bus() and pci_add_new_bus() bus = pci_alloc_bus() device_register(&bus->dev) pci_create_legacy_file(bus) 2.a) pci_scan_child_bus(bus) set is_added flag for PCI root buses 2.b) pci_bus_add_devices(bus) set is_added flag for normal PCI buses So pci_remove_bus() shouldn't use is_added flag to guard invoking of pci_remove_lagecy_files() and device_unregister(). Signed-off-by: Jiang Liu <jiang.liu@xxxxxxxxxx> Signed-off-by: Yijing Wang <wangyijing@xxxxxxxxxx> Cc: Yinghai Lu <yinghai@xxxxxxxxxx> Cc: "Rafael J. Wysocki" <rafael.j.wysocki@xxxxxxxxx> Cc: Toshi Kani <toshi.kani@xxxxxx> Cc: linux-pci@xxxxxxxxxxxxxxx Cc: linux-kernel@xxxxxxxxxxxxxxx --- drivers/pci/remove.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/pci/remove.c b/drivers/pci/remove.c index cc875e6..a831880 100644 --- a/drivers/pci/remove.c +++ b/drivers/pci/remove.c @@ -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); } -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html