Commit ad1d3a26 authored by Prarit Bhargava's avatar Prarit Bhargava Committed by Wim Van Sebroeck

watchdog: iTCO_wdt.c: remove extra pci_dev_put()'s from init code

The iTCO_wdt driver erroneously releases the pci_dev, and causes PCI hotremove
to fail because of an incorrect usage count.

The probe for this driver does a for_each_pci_dev() which gets a reference for
a pci_dev when iTCO_wdt_init() is successful.  The for_each_pci_dev() loop
puts a reference for a pci_dev when iTCO_wdt_init() fails, so the
iTCO_wdt_init() does not need to do any pci_dev_put()'s.

The only pci_dev_put() that is required is in the iTCO_wdt_cleanup() function.
Signed-off-by: default avatarPrarit Bhargava <prarit@redhat.com>
Signed-off-by: default avatarWim Van Sebroeck <wim@iguana.be>
parent b63aa731
...@@ -786,7 +786,6 @@ static int __devinit iTCO_wdt_init(struct pci_dev *pdev, ...@@ -786,7 +786,6 @@ static int __devinit iTCO_wdt_init(struct pci_dev *pdev,
/* Something's wrong here, ACPIBASE has to be set */ /* Something's wrong here, ACPIBASE has to be set */
printk(KERN_ERR PFX "failed to get TCOBASE address, " printk(KERN_ERR PFX "failed to get TCOBASE address, "
"device disabled by hardware/BIOS\n"); "device disabled by hardware/BIOS\n");
pci_dev_put(pdev);
return -ENODEV; return -ENODEV;
} }
iTCO_wdt_private.iTCO_version = iTCO_wdt_private.iTCO_version =
...@@ -886,7 +885,6 @@ static int __devinit iTCO_wdt_init(struct pci_dev *pdev, ...@@ -886,7 +885,6 @@ static int __devinit iTCO_wdt_init(struct pci_dev *pdev,
if (iTCO_wdt_private.iTCO_version == 2) if (iTCO_wdt_private.iTCO_version == 2)
iounmap(iTCO_wdt_private.gcs); iounmap(iTCO_wdt_private.gcs);
out: out:
pci_dev_put(iTCO_wdt_private.pdev);
iTCO_wdt_private.ACPIBASE = 0; iTCO_wdt_private.ACPIBASE = 0;
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment