diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c --- a/drivers/scsi/gdth.c +++ b/drivers/scsi/gdth.c @@ -781,12 +781,13 @@ static void __init gdth_search_dev(gdth_ *cnt, vendor, device)); pdev = NULL; - while ((pdev = pci_find_device(vendor, device, pdev)) - != NULL) { + while ((pdev = pci_get_device(vendor, device, pdev)) != NULL) { if (pci_enable_device(pdev)) continue; - if (*cnt >= MAXHA) + if (*cnt >= MAXHA) { + pci_dev_put(pdev); return; + } /* GDT PCI controller found, resources are already in pdev */ pcistr[*cnt].pdev = pdev; pcistr[*cnt].vendor_id = vendor; @@ -4542,6 +4543,8 @@ static int __init gdth_detect(Scsi_Host_ } } + pci_dev_put(pcistr[ctr].pdev); + if (err) { printk("GDT-PCI %d: Error during device scan\n", hanum); --gdth_ctr_count;