From 6582301f83c6ccaede7352fc6e6d3e7b46161713 Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Fri, 14 Jul 2023 10:27:40 -0700 Subject: [PATCH] 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 --- sys/dev/pci/pci_host_generic_den0115.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/dev/pci/pci_host_generic_den0115.c b/sys/dev/pci/pci_host_generic_den0115.c index d620a755a1c..cfef3482496 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);