[PATCH] via82cxxx_audio: Use pci_get_device

From: Alan Cox
Date: Fri Sep 15 2006 - 09:45:43 EST


pci_find_device is not refcounting and should be getting killed off.

Signed-off-by: Alan Cox <alan@xxxxxxxxxx>

diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.18-rc6-mm1/sound/oss/via82cxxx_audio.c linux-2.6.18-rc6-mm1/sound/oss/via82cxxx_audio.c
--- linux.vanilla-2.6.18-rc6-mm1/sound/oss/via82cxxx_audio.c 2006-09-11 11:02:49.000000000 +0100
+++ linux-2.6.18-rc6-mm1/sound/oss/via82cxxx_audio.c 2006-09-14 17:29:54.000000000 +0100
@@ -1547,7 +1547,7 @@

DPRINTK ("ENTER\n");

- while ((pdev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pdev)) != NULL) {
+ while ((pdev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pdev)) != NULL) {
drvr = pci_dev_driver (pdev);
if (drvr == &via_driver) {
assert (pci_get_drvdata (pdev) != NULL);
@@ -1562,6 +1562,7 @@
return -ENODEV;

match:
+ pci_dev_put(pdev);
file->private_data = card->ac97;

DPRINTK ("EXIT, returning 0\n");
@@ -3245,7 +3246,7 @@
}

card = NULL;
- while ((pdev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pdev)) != NULL) {
+ while ((pdev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pdev)) != NULL) {
drvr = pci_dev_driver (pdev);
if (drvr == &via_driver) {
assert (pci_get_drvdata (pdev) != NULL);
@@ -3264,6 +3265,7 @@
return -ENODEV;

match:
+ pci_dev_put(pdev);
if (nonblock) {
if (!mutex_trylock(&card->open_mutex)) {
DPRINTK ("EXIT, returning -EAGAIN\n");

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/