From akpm@linux-foundation.org Thu May 10 22:59:21 2007 Message-Id: <200705110558.l4B5wwa0008020@shell0.pdx.osdl.net> From: Ben Gardner Subject: PCI: Fix pci_find_present To: greg@kroah.com Cc: akpm@linux-foundation.org, gardner.ben@gmail.com, alan@lxorguk.ukuu.org.uk From: akpm@linux-foundation.org Date: Thu, 10 May 2007 22:58:58 -0700 From: Ben Gardner 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 Cc: Alan Cox Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- drivers/pci/search.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/pci/search.c +++ b/drivers/pci/search.c @@ -403,10 +403,11 @@ const struct pci_device_id *pci_find_pre 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; }