Attention is currently required from: Edward O'Callaghan. Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/59276 )
Change subject: pcidev: Move pci_get_dev() logic into canonical place ......................................................................
Patch Set 3:
(1 comment)
File board_enable.c:
https://review.coreboot.org/c/flashrom/+/59276/comment/3a6df8e2_24247641 PS3, Line 1097: dev = pcidev_clonedev(dev); NB. does the code here make sense to anyone? It looks like it's cloning the `dev` just to leak the memory? Maybe this part was written before the pci_dev_find_vendorclass() above?
Never mind, I figured it out, looking at the signature of pci_get_dev() the last parameter is the function number. So what happens here is that we match one device by vendor and class, and depending on its ID maybe fetch the second function under the same mult-function device. So basically another device. Despite the leaking, the code seems to make sense. Moving the `1` into a function with a generic name, not so much :-/