From 992f5b16afa73d0ea63c8a886a78ad2eda928e37 Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Thu, 15 Feb 2024 16:05:09 -0800 Subject: pci_host_generic: Set a valid error if allocating a range resource fails Previously pci_host_generic_attach was returning 0 (success) incorrectly if allocating a range failed. The error value was 0 from the previously successful call to bus_set_resource in this case. Fixes: d79b6b8ec267 pci_host_generic: Don't rewrite resource start address for translation --- sys/dev/pci/pci_host_generic.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/pci/pci_host_generic.c b/sys/dev/pci/pci_host_generic.c index 45a478634d20..ca384d9a1483 100644 --- a/sys/dev/pci/pci_host_generic.c +++ b/sys/dev/pci/pci_host_generic.c @@ -216,6 +216,7 @@ pci_host_generic_core_attach(device_t dev) if (sc->ranges[tuple].res == NULL) { device_printf(dev, "failed to allocate resource for range %d\n", tuple); + error = ENXIO; goto err_rman_manage; } } -- cgit v1.2.3