[PATCH] PCI: pci_find_device remove (sparc64/kernel/ebus.c)
authorJiri Slaby <jirislaby@gmail.com>
Mon, 7 Nov 2005 07:39:35 +0000 (23:39 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 9 Jan 2006 20:13:15 +0000 (12:13 -0800)
Signed-off-by: Jiri Slaby <xslaby@fi.muni.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
arch/sparc64/kernel/ebus.c

index 6ffbeb701940173254301bcad8568a26ee2a79ec..7991e919d8ab6801605f040c1b16f2df1277975f 100644 (file)
@@ -527,18 +527,12 @@ static struct pci_dev *find_next_ebus(struct pci_dev *start, int *is_rio_p)
 {
        struct pci_dev *pdev = start;
 
-       do {
-               pdev = pci_find_device(PCI_VENDOR_ID_SUN, PCI_ANY_ID, pdev);
-               if (pdev &&
-                   (pdev->device == PCI_DEVICE_ID_SUN_EBUS ||
-                    pdev->device == PCI_DEVICE_ID_SUN_RIO_EBUS))
+       while ((pdev = pci_get_device(PCI_VENDOR_ID_SUN, PCI_ANY_ID, pdev)))
+               if (pdev->device == PCI_DEVICE_ID_SUN_EBUS ||
+                       pdev->device == PCI_DEVICE_ID_SUN_RIO_EBUS)
                        break;
-       } while (pdev != NULL);
 
-       if (pdev && (pdev->device == PCI_DEVICE_ID_SUN_RIO_EBUS))
-               *is_rio_p = 1;
-       else
-               *is_rio_p = 0;
+       *is_rio_p = !!(pdev && (pdev->device == PCI_DEVICE_ID_SUN_RIO_EBUS));
 
        return pdev;
 }
@@ -637,6 +631,7 @@ void __init ebus_init(void)
                ebus->is_rio = is_rio;
                ++num_ebus;
        }
+       pci_dev_put(pdev); /* XXX for the case, when ebusnd is 0, is it OK? */
 
 #ifdef CONFIG_SUN_AUXIO
        auxio_probe();