Skip to content

Commit

Permalink
PCI: Fix pci_find_present
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: Alan Cox <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
bengardner authored and gregkh committed May 31, 2007
1 parent e3008de commit 3c92c57
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/pci/search.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 3c92c57

Please sign in to comment.