From db7cfc199e950ec65b41c0af9c8cd515410ef230 Mon Sep 17 00:00:00 2001 From: Zbigniew Bodek Date: Thu, 28 Jan 2016 16:58:49 +0000 Subject: [PATCH] Fix VNIC enumeration after r294993 and r294990 ofw_bus_get_node() must be tested against negative values since missing parent bus method will result in calling the default method which simply returns (-1): sys/dev/ofw/ofw_bus_if.m This was lost in the review process. Obtained from: Semihalf Sponsored by: Cavium --- sys/arm64/cavium/thunder_pcie_fdt.c | 4 ++-- sys/dev/vnic/thunder_bgx_fdt.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/arm64/cavium/thunder_pcie_fdt.c b/sys/arm64/cavium/thunder_pcie_fdt.c index bde453741802..f1624f615484 100644 --- a/sys/arm64/cavium/thunder_pcie_fdt.c +++ b/sys/arm64/cavium/thunder_pcie_fdt.c @@ -276,7 +276,7 @@ thunder_pcie_ofw_bus_alloc_res(device_t bus, device_t child, int type, int *rid, int i; /* For PCIe devices that do not have FDT nodes, use PCIB method */ - if (ofw_bus_get_node(child) == 0) { + if ((int)ofw_bus_get_node(child) <= 0) { return (thunder_pcie_alloc_resource(bus, child, type, rid, start, end, count, flags)); } @@ -329,7 +329,7 @@ thunder_pcie_ofw_bus_rel_res(device_t bus, device_t child, int type, int rid, { /* For PCIe devices that do not have FDT nodes, use PCIB method */ - if (ofw_bus_get_node(child) == 0) { + if ((int)ofw_bus_get_node(child) <= 0) { return (thunder_pcie_release_resource(bus, child, type, rid, res)); } diff --git a/sys/dev/vnic/thunder_bgx_fdt.c b/sys/dev/vnic/thunder_bgx_fdt.c index 23f5e4137575..ec6e68f64850 100644 --- a/sys/dev/vnic/thunder_bgx_fdt.c +++ b/sys/dev/vnic/thunder_bgx_fdt.c @@ -244,7 +244,7 @@ bgx_fdt_find_node(struct bgx *bgx) } node = ofw_bus_get_node(root_pcib); - if (node == 0) { + if ((int)node <= 0) { device_printf(bgx->dev, "No parent FDT node for BGX\n"); goto out; }