mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-13 14:40:22 +00:00
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)
This commit is contained in:
parent
8f32e46db7
commit
6fc608bf2c
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=292159
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user