Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Sep 2020 09:42:38 +0000 (UTC)
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r365558 - head/sys/dev/gpio
Message-ID:  <202009100942.08A9gcEu039918@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: andrew
Date: Thu Sep 10 09:42:37 2020
New Revision: 365558
URL: https://svnweb.freebsd.org/changeset/base/365558

Log:
  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

Modified:
  head/sys/dev/gpio/ofw_gpiobus.c

Modified: head/sys/dev/gpio/ofw_gpiobus.c
==============================================================================
--- head/sys/dev/gpio/ofw_gpiobus.c	Thu Sep 10 09:37:30 2020	(r365557)
+++ head/sys/dev/gpio/ofw_gpiobus.c	Thu Sep 10 09:42:37 2020	(r365558)
@@ -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 *



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202009100942.08A9gcEu039918>