diff --git a/sys/arm64/arm64/gic_v3_fdt.c b/sys/arm64/arm64/gic_v3_fdt.c --- a/sys/arm64/arm64/gic_v3_fdt.c +++ b/sys/arm64/arm64/gic_v3_fdt.c @@ -86,7 +86,7 @@ /* * Helper functions declarations. */ -static int gic_v3_ofw_bus_attach(device_t); +static void gic_v3_ofw_bus_attach(device_t); /* * Device interface. @@ -193,12 +193,7 @@ * GIC will act as a bus in that case. * Failure here will not affect main GIC functionality. */ - if (gic_v3_ofw_bus_attach(dev) != 0) { - if (bootverbose) { - device_printf(dev, - "Failed to attach ITS to this GIC\n"); - } - } + gic_v3_ofw_bus_attach(dev); if (device_get_children(dev, &sc->gic_children, &sc->gic_nchildren) != 0) sc->gic_nchildren = 0; @@ -298,7 +293,7 @@ * Collects and configures device informations and finally * adds ITS device as a child of GICv3 in Newbus hierarchy. */ -static int +static void gic_v3_ofw_bus_attach(device_t dev) { struct gic_v3_ofw_devinfo *di; @@ -313,8 +308,13 @@ if (parent > 0) { rv = gic_v3_ofw_fill_ranges(parent, sc, &addr_cells, &size_cells); - if (rv != 0) - return (rv); + if (rv != 0) { + if (bootverbose) { + device_printf(dev, + "Failed to attach ITS to this GIC\n"); + } + goto vgic; + } /* Iterate through all GIC subordinates */ for (node = OF_child(parent); node > 0; node = OF_peer(node)) { @@ -369,28 +369,31 @@ sc->gic_nchildren++; device_set_ivars(child, di); } - } - /* - * If there is a vgic maintanance interrupt add a virtual gic - * child so we can use this in the vmm module for bhyve. - */ - if (OF_hasprop(parent, "interrupts")) { - child = device_add_child(dev, "vgic", DEVICE_UNIT_ANY); - if (child == NULL) { - device_printf(dev, "Could not add vgic child\n"); - } else { - di = malloc(sizeof(*di), M_GIC_V3, M_WAITOK | M_ZERO); - resource_list_init(&di->di_rl); - di->di_gic_dinfo.gic_domain = -1; - di->di_gic_dinfo.is_vgic = 1; - device_set_ivars(child, di); - sc->gic_nchildren++; +vgic: + + /* + * If there is a vgic maintanance interrupt add a virtual gic + * child so we can use this in the vmm module for bhyve. + */ + if (OF_hasprop(parent, "interrupts")) { + child = device_add_child(dev, "vgic", DEVICE_UNIT_ANY); + if (child == NULL) { + device_printf(dev, + "Could not add vgic child\n"); + } else { + di = malloc(sizeof(*di), M_GIC_V3, + M_WAITOK | M_ZERO); + resource_list_init(&di->di_rl); + di->di_gic_dinfo.gic_domain = -1; + di->di_gic_dinfo.is_vgic = 1; + device_set_ivars(child, di); + sc->gic_nchildren++; + } } } bus_attach_children(dev); - return (0); } static struct resource_list *