PCI: Fix pci_find_present
authorBen Gardner <gardner.ben@gmail.com>
Fri, 11 May 2007 05:58:58 +0000 (22:58 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 31 May 2007 23:56:37 +0000 (16:56 -0700)
pci_find_present() is only matching the last item in the list of ids.

The break after the match is found only escapes the for loop, not the
while loop, so found gets reset to NULL on the next pass.

Signed-off-by: Ben Gardner <gardner.ben@gmail.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/pci/search.c

index b137a27472c7feefef492da45e7058cc3356c8bb..c13232435dc06322f824b1f4fd07d34bdce112bb 100644 (file)
@@ -403,10 +403,11 @@ const struct pci_device_id *pci_find_present(const struct pci_device_id *ids)
        while (ids->vendor || ids->subvendor || ids->class_mask) {
                list_for_each_entry(dev, &pci_devices, global_list) {
                        if ((found = pci_match_one_device(ids, dev)) != NULL)
-                               break;
+                               goto exit;
                }
                ids++;
        }
+exit:
        up_read(&pci_bus_sem);
        return found;
 }