diff options
author | mmel <mmel@FreeBSD.org> | 2015-12-13 09:05:55 +0000 |
---|---|---|
committer | mmel <mmel@FreeBSD.org> | 2015-12-13 09:05:55 +0000 |
commit | 4bf1d570d1bb3528f58a1704ae2b488d0f303d46 (patch) | |
tree | 3cfeca7528e7cd84ca5ec22cd6a1df94789f5466 | |
parent | 0f120b427b87875206ff7d1076f677baddb201f1 (diff) | |
download | FreeBSD-src-4bf1d570d1bb3528f58a1704ae2b488d0f303d46.zip FreeBSD-src-4bf1d570d1bb3528f58a1704ae2b488d0f303d46.tar.gz |
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)
-rw-r--r-- | sys/dev/fdt/simplebus.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/dev/fdt/simplebus.c b/sys/dev/fdt/simplebus.c index 4cf063e..4e5bdd2 100644 --- a/sys/dev/fdt/simplebus.c +++ b/sys/dev/fdt/simplebus.c @@ -304,6 +304,8 @@ simplebus_get_devinfo(device_t bus __unused, device_t child) 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 __unused, device_t child) 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_devinfo *di) { 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"); |