svn commit: r292159 - head/sys/dev/fdt

Michal Meloun mmel at FreeBSD.org
Sun Dec 13 09:05:56 UTC 2015


Author: mmel
Date: Sun Dec 13 09:05:55 2015
New Revision: 292159
URL: https://svnweb.freebsd.org/changeset/base/292159

Log:
  SIMPLEBUS: Don't panic if child device doesn't have devinfo set.
  Strictly speaking, missing devinfo is error which can be caused
  by instantiating child using device_add_child() instead of
  BUS_ADD_CHILD(). However, we can tolerate it.
  
  Approved by:	kib (mentor)

Modified:
  head/sys/dev/fdt/simplebus.c

Modified: head/sys/dev/fdt/simplebus.c
==============================================================================
--- head/sys/dev/fdt/simplebus.c	Sun Dec 13 08:27:14 2015	(r292158)
+++ head/sys/dev/fdt/simplebus.c	Sun Dec 13 09:05:55 2015	(r292159)
@@ -304,6 +304,8 @@ simplebus_get_devinfo(device_t bus __unu
         struct simplebus_devinfo *ndi;
         
         ndi = device_get_ivars(child);
+	if (ndi == NULL)
+		return (NULL);
         return (&ndi->obdinfo);
 }
 
@@ -313,6 +315,8 @@ simplebus_get_resource_list(device_t bus
 	struct simplebus_devinfo *ndi;
 
 	ndi = device_get_ivars(child);
+	if (ndi == NULL)
+		return (NULL);
 	return (&ndi->rl);
 }
 
@@ -380,6 +384,8 @@ simplebus_print_res(struct simplebus_dev
 {
 	int rv;
 
+	if (di == NULL)
+		return (0);
 	rv = 0;
 	rv += resource_list_print_type(&di->rl, "mem", SYS_RES_MEMORY, "%#lx");
 	rv += resource_list_print_type(&di->rl, "irq", SYS_RES_IRQ, "%ld");


More information about the svn-src-head mailing list