git: 94287656264f - main - ofw_pci: fix probing for non-DT cases

Marcin Wojtas mw at FreeBSD.org
Thu Jul 1 18:35:53 UTC 2021


The branch main has been updated by mw:

URL: https://cgit.FreeBSD.org/src/commit/?id=94287656264fe1f984586220cb7fd2a2e6f89708

commit 94287656264fe1f984586220cb7fd2a2e6f89708
Author:     Kornel Duleba <mindal at semihalf.com>
AuthorDate: 2021-07-01 18:27:41 +0000
Commit:     Marcin Wojtas <mw at FreeBSD.org>
CommitDate: 2021-07-01 18:35:23 +0000

    ofw_pci: fix probing for non-DT cases
    
    phandle_t is a uint32_t type, <= 0 comparison doesn't work with it as intended.
    This caused the ofw_pci code to attach to PCI bus on ACPI based systems.
    Since 3eae4e106ac7 ("Fix error value returned by ofw_bus_gen_get_node().")
    ofw subsystem can only return -1 for invalid nodes. Use that.
    
    MFC after: 4 weeks
    Reviewed by: mw
    Differential revision: https://reviews.freebsd.org/D30953
---
 sys/dev/ofw/ofw_pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/dev/ofw/ofw_pci.c b/sys/dev/ofw/ofw_pci.c
index c7ed7c5c8fe9..7f7aad379ddc 100644
--- a/sys/dev/ofw/ofw_pci.c
+++ b/sys/dev/ofw/ofw_pci.c
@@ -77,7 +77,7 @@ ofw_pci_probe(device_t dev)
 	device_t parent;
 
 	parent = device_get_parent(dev);
-	if (ofw_bus_get_node(parent) <= 0)
+	if (ofw_bus_get_node(parent) == -1)
 		return (ENXIO);
 
 	device_set_desc(dev, "OFW PCI bus");


More information about the dev-commits-src-main mailing list