Only manage ofw gpio providers on ofw systems

On arm64 we may boot via ACPI. In this case we will still try to manage the
gpio providers as if we are using FDT. Fix this by checking if the FDT node
is valid before registering a cross reference.

Sponsored by:	Innovate UK
This commit is contained in:
andrew 2020-09-10 09:42:37 +00:00
parent 45dc9047bd
commit 7553af983e

View File

@ -197,7 +197,8 @@ ofw_gpiobus_register_provider(device_t provider)
phandle_t node;
node = ofw_bus_get_node(provider);
OF_device_register_xref(OF_xref_from_node(node), provider);
if (node != -1)
OF_device_register_xref(OF_xref_from_node(node), provider);
}
void
@ -206,7 +207,8 @@ ofw_gpiobus_unregister_provider(device_t provider)
phandle_t node;
node = ofw_bus_get_node(provider);
OF_device_register_xref(OF_xref_from_node(node), NULL);
if (node != -1)
OF_device_register_xref(OF_xref_from_node(node), NULL);
}
static struct ofw_gpiobus_devinfo *