[PATCH] via82cxxx_audio: Use pci_get_device

pci_find_device is not refcounting and should be getting killed off.

Signed-off-by: Alan Cox <alan@redhat.com>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Alan Cox 2006-09-30 23:27:26 -07:00 committed by Linus Torvalds
parent f2443ab6c4
commit 14fef6414b

View File

@ -1547,7 +1547,7 @@ static int via_mixer_open (struct inode *inode, struct file *file)
DPRINTK ("ENTER\n"); 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); drvr = pci_dev_driver (pdev);
if (drvr == &via_driver) { if (drvr == &via_driver) {
assert (pci_get_drvdata (pdev) != NULL); assert (pci_get_drvdata (pdev) != NULL);
@ -1562,6 +1562,7 @@ static int via_mixer_open (struct inode *inode, struct file *file)
return -ENODEV; return -ENODEV;
match: match:
pci_dev_put(pdev);
file->private_data = card->ac97; file->private_data = card->ac97;
DPRINTK ("EXIT, returning 0\n"); DPRINTK ("EXIT, returning 0\n");
@ -3245,7 +3246,7 @@ static int via_dsp_open (struct inode *inode, struct file *file)
} }
card = NULL; 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); drvr = pci_dev_driver (pdev);
if (drvr == &via_driver) { if (drvr == &via_driver) {
assert (pci_get_drvdata (pdev) != NULL); assert (pci_get_drvdata (pdev) != NULL);
@ -3264,6 +3265,7 @@ static int via_dsp_open (struct inode *inode, struct file *file)
return -ENODEV; return -ENODEV;
match: match:
pci_dev_put(pdev);
if (nonblock) { if (nonblock) {
if (!mutex_trylock(&card->open_mutex)) { if (!mutex_trylock(&card->open_mutex)) {
DPRINTK ("EXIT, returning -EAGAIN\n"); DPRINTK ("EXIT, returning -EAGAIN\n");