Commit 3c92c57af9a24a08b8d2f76650b1209239914fcd
Committed by
Greg Kroah-Hartman
1 parent
e3008dedff
Exists in
master
and in
4 other branches
PCI: Fix pci_find_present
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>
Showing 1 changed file with 2 additions and 1 deletions Side-by-side Diff
drivers/pci/search.c
... | ... | @@ -403,10 +403,11 @@ |
403 | 403 | while (ids->vendor || ids->subvendor || ids->class_mask) { |
404 | 404 | list_for_each_entry(dev, &pci_devices, global_list) { |
405 | 405 | if ((found = pci_match_one_device(ids, dev)) != NULL) |
406 | - break; | |
406 | + goto exit; | |
407 | 407 | } |
408 | 408 | ids++; |
409 | 409 | } |
410 | +exit: | |
410 | 411 | up_read(&pci_bus_sem); |
411 | 412 | return found; |
412 | 413 | } |