PCI DEN0115: Reliably check for a memory resource during probe.

rid was stack garbage, so the bus_alloc_resource_any() call could fail
and fall through to the SMCCC version check even if a bridge had a
memory resource.

Debugging help:	jrtc27
Reviewed by:	jrtc27
Fixes:		c9a05c0722 Add a PCI driver that follows the Arm DEN0115 spec
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D41025
This commit is contained in:
John Baldwin 2023-07-14 10:27:40 -07:00
parent a248abb55a
commit 6582301f83

View file

@ -71,10 +71,11 @@ pci_host_acpi_smccc_probe(device_t dev)
return (ENXIO);
/*
* Check we have memory resources. We may have a non-memory
* Check if we have memory resources. We may have a non-memory
* mapped device, e.g. using the Arm PCI Configuration Space
* Access Firmware Interface (DEN0115).
*/
rid = 0;
res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, 0);
if (res != NULL) {
bus_release_resource(dev, SYS_RES_MEMORY, rid, res);