aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2023-07-14 17:27:40 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2023-07-14 17:27:40 +0000
commit6582301f83c6ccaede7352fc6e6d3e7b46161713 (patch)
tree7433945f6e9746c2b20c78f6c850ce683a07c42e
parenta248abb55a51830d811b45d78eaacf5df108148b (diff)
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: c9a05c072270 Add a PCI driver that follows the Arm DEN0115 spec Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D41025
-rw-r--r--sys/dev/pci/pci_host_generic_den0115.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/dev/pci/pci_host_generic_den0115.c b/sys/dev/pci/pci_host_generic_den0115.c
index d620a755a1ca..cfef34824965 100644
--- a/sys/dev/pci/pci_host_generic_den0115.c
+++ b/sys/dev/pci/pci_host_generic_den0115.c
@@ -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);