- Handle errors when adding children to nexus. This sittuation

might occure when there is dublicate of child's entry in hints
This commit is contained in:
Oleksandr Tymoshenko 2009-11-03 06:42:55 +00:00
parent 45ab86915b
commit 3682174ee5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/projects/mips/; revision=198842

View File

@ -257,6 +257,8 @@ nexus_hinted_child(device_t bus, const char *dname, int dunit)
int mem_hints_count;
child = BUS_ADD_CHILD(bus, 0, dname, dunit);
if (child == NULL)
return;
/*
* Set hard-wired resources for hinted child using
@ -306,6 +308,10 @@ nexus_add_child(device_t bus, int order, const char *name, int unit)
resource_list_init(&ndev->nx_resources);
child = device_add_child_ordered(bus, order, name, unit);
if (child == NULL) {
device_printf(bus, "failed to add child: %s%d\n", name, unit);
return (0);
}
/* should we free this in nexus_child_detached? */
device_set_ivars(child, ndev);