ChangeSet 1.1254.4.11, 2003/06/04 10:29:42-07:00, greg@kroah.com [PATCH] PCI: Grab reference count on pci_dev if the pci driver binds to the device. And remember to decrement the count after remove() is called. drivers/pci/pci-driver.c | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) diff -Nru a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c --- a/drivers/pci/pci-driver.c Wed Jun 4 18:11:37 2003 +++ b/drivers/pci/pci-driver.c Wed Jun 4 18:11:37 2003 @@ -138,10 +138,11 @@ drv = to_pci_driver(dev->driver); pci_dev = to_pci_dev(dev); - if (get_device(dev)) { - error = __pci_device_probe(drv, pci_dev); - put_device(dev); - } + pci_get_dev(pci_dev); + error = __pci_device_probe(drv, pci_dev); + if (error) + pci_put_dev(pci_dev); + return error; } @@ -155,6 +156,7 @@ drv->remove(pci_dev); pci_dev->driver = NULL; } + pci_put_dev(pci_dev); return 0; }