diff options
Diffstat (limited to 'drivers/pci/remove.c')
-rw-r--r-- | drivers/pci/remove.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/pci/remove.c b/drivers/pci/remove.c index 9684e1bde277..d3c77cbe3279 100644 --- a/drivers/pci/remove.c +++ b/drivers/pci/remove.c | |||
@@ -18,13 +18,11 @@ static void pci_free_resources(struct pci_dev *dev) | |||
18 | 18 | ||
19 | static void pci_stop_dev(struct pci_dev *dev) | 19 | static void pci_stop_dev(struct pci_dev *dev) |
20 | { | 20 | { |
21 | if (!dev->global_list.next) | 21 | if (dev->is_added) { |
22 | return; | ||
23 | |||
24 | if (!list_empty(&dev->global_list)) { | ||
25 | pci_proc_detach_device(dev); | 22 | pci_proc_detach_device(dev); |
26 | pci_remove_sysfs_dev_files(dev); | 23 | pci_remove_sysfs_dev_files(dev); |
27 | device_unregister(&dev->dev); | 24 | device_unregister(&dev->dev); |
25 | dev->is_added = 0; | ||
28 | down_write(&pci_bus_sem); | 26 | down_write(&pci_bus_sem); |
29 | list_del(&dev->global_list); | 27 | list_del(&dev->global_list); |
30 | dev->global_list.next = dev->global_list.prev = NULL; | 28 | dev->global_list.next = dev->global_list.prev = NULL; |