diff options
Diffstat (limited to 'drivers/pci/pci-driver.c')
-rw-r--r-- | drivers/pci/pci-driver.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index 194f1d21d3d7..e5ae3a0c13bb 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c | |||
@@ -329,8 +329,8 @@ static int pci_default_resume(struct pci_dev *pci_dev) | |||
329 | /* restore the PCI config space */ | 329 | /* restore the PCI config space */ |
330 | pci_restore_state(pci_dev); | 330 | pci_restore_state(pci_dev); |
331 | /* if the device was enabled before suspend, reenable */ | 331 | /* if the device was enabled before suspend, reenable */ |
332 | if (pci_dev->is_enabled) | 332 | if (atomic_read(&pci_dev->enable_cnt)) |
333 | retval = pci_enable_device(pci_dev); | 333 | retval = __pci_enable_device(pci_dev); |
334 | /* if the device was busmaster before the suspend, make it busmaster again */ | 334 | /* if the device was busmaster before the suspend, make it busmaster again */ |
335 | if (pci_dev->is_busmaster) | 335 | if (pci_dev->is_busmaster) |
336 | pci_set_master(pci_dev); | 336 | pci_set_master(pci_dev); |
@@ -445,9 +445,12 @@ int __pci_register_driver(struct pci_driver *drv, struct module *owner) | |||
445 | 445 | ||
446 | /* register with core */ | 446 | /* register with core */ |
447 | error = driver_register(&drv->driver); | 447 | error = driver_register(&drv->driver); |
448 | if (error) | ||
449 | return error; | ||
448 | 450 | ||
449 | if (!error) | 451 | error = pci_create_newid_file(drv); |
450 | error = pci_create_newid_file(drv); | 452 | if (error) |
453 | driver_unregister(&drv->driver); | ||
451 | 454 | ||
452 | return error; | 455 | return error; |
453 | } | 456 | } |