pcidev: Always fetch ident info

As discovered earlier[1], the `vendor_id` and `device_id` fields are not
always automatically set. However, we use these fields throughout flash-
rom. To not lose track when we actually fetched them, let's always call
pci_fill_info(PCI_FILL_IDENT) before returning a `pci_dev` handle.

[1] Commit ca2e3bce0 (pcidev.c: populate IDs with pci_fill_info())

Backported to older versions where pcidev handling was much more
scattered.

Signed-off-by: Nico Huber <nico.h@gmx.de>
Change-Id: Iae2511178bec44343cbe902722fdca9eda036059
Ticket: https://ticket.coreboot.org/issues/367
Reviewed-on: https://review.coreboot.org/c/flashrom/+/64573
Reviewed-on: https://review.coreboot.org/c/flashrom/+/67877
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Singer <felixsinger@posteo.net>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
diff --git a/internal.c b/internal.c
index 44570a5..60f3da1 100644
--- a/internal.c
+++ b/internal.c
@@ -34,8 +34,10 @@
 		if (pci_filter_match(&filter, temp)) {
 			/* Read PCI class */
 			tmp2 = pci_read_word(temp, 0x0a);
-			if (tmp2 == devclass)
+			if (tmp2 == devclass) {
+				pci_fill_info(temp, PCI_FILL_IDENT);
 				return temp;
+			}
 		}
 
 	return NULL;
@@ -50,9 +52,12 @@
 	filter.vendor = vendor;
 	filter.device = device;
 
-	for (temp = pacc->devices; temp; temp = temp->next)
-		if (pci_filter_match(&filter, temp))
+	for (temp = pacc->devices; temp; temp = temp->next) {
+		if (pci_filter_match(&filter, temp)) {
+			pci_fill_info(temp, PCI_FILL_IDENT);
 			return temp;
+		}
+	}
 
 	return NULL;
 }
@@ -72,8 +77,10 @@
 			if ((card_vendor ==
 			     pci_read_word(temp, PCI_SUBSYSTEM_VENDOR_ID))
 			    && (card_device ==
-				pci_read_word(temp, PCI_SUBSYSTEM_ID)))
+				pci_read_word(temp, PCI_SUBSYSTEM_ID))) {
+				pci_fill_info(temp, PCI_FILL_IDENT);
 				return temp;
+			}
 		}
 
 	return NULL;