diff --git a/pcid/src/pci_header.rs b/pcid/src/pci_header.rs index 471f74b27c..95c960851a 100644 --- a/pcid/src/pci_header.rs +++ b/pcid/src/pci_header.rs @@ -42,12 +42,13 @@ impl PciHeader { access: &impl ConfigRegionAccess, addr: PciAddress, ) -> Result { - if unsafe { access.read(addr, 0) } == 0xffffffff { + let header = TyPciHeader::new(addr); + let (vendor_id, device_id) = header.id(access); + + if vendor_id == 0xffff && device_id == 0xffff { return Err(PciHeaderError::NoDevice); } - let header = TyPciHeader::new(addr); - let (vendor_id, device_id) = header.id(access); let (revision, class, subclass, interface) = header.revision_and_class(access); let header_type = header.header_type(access); let shared = SharedPciHeader {