Skip to contentSkip to conversation

: watchdog/iTCO: remove extra pci_dev_put()'s from init code

PATCH In review Prarit Bhargava 2 participants 2 messages Oct 27, 2010 – Oct 29, 2010 Watchdog device drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 : watchdog/iTCO: remove extra pci_dev_put()'s from init code

[Wim -- I'm not on the list so please cc me on any questions. Also, I had pushed two previous iTCO_wdt patches to linux-watchdog but I do not see that they have been committed ... was there something wrong with them?

Thanks,

P. ]

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.

drivers/watchdog/iTCO_wdt.c +0 -2
index 69de871..8135bf6 100644
@@ -782,7 +782,6 @@ static int __devinit iTCO_wdt_init(struct pci_dev *pdev,
 	if (base_address == 0x00000000) {
 		/* Something's wrong here, ACPIBASE has to be set */
 		printk(KERN_ERR PFX "failed to get TCOBASE address\n");
-		pci_dev_put(pdev);
 		return -ENODEV;
 	}
 	iTCO_wdt_private.iTCO_version =
@@ -880,7 +879,6 @@ out_unmap:
 	if (iTCO_wdt_private.iTCO_version == 2)
 		iounmap(iTCO_wdt_private.gcs);
 out:
-	pci_dev_put(iTCO_wdt_private.pdev);
 	iTCO_wdt_private.ACPIBASE = 0;
 	return ret;
 }
#1 lore raw

Hi Prarit,

Quoted 3 lines

[Wim -- I'm not on the list so please cc me on any questions. Also, I had pushed two previous iTCO_wdt patches to linux-watchdog but I do not see that they have been committed ... was there something wrong with them?

Sorry for the "radio" silence, but I had to finish an urgent project.

This patch (pci_dev_put) has been added yesterday evening.
The patch you sent in for the clarification of error messages has also been added (but with different identation so that it looks similar to the rest of the code). I did not keep you change of found++ to found = 1 in the same patch.

You are talking about 2 patches that you pushed before. I only saw the one about clarification of error messages. Could you resent the other one?)

Thanks in advance,
Wim.