Add debug writes in error cases that, in theory, should never happen

This commit is contained in:
Warner Losh 2006-04-06 04:32:29 +00:00
parent 723c740a55
commit 5ec7256cb1
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=157564

View file

@ -201,11 +201,14 @@ at91_add_child(device_t dev, int prio, const char *name, int unit,
struct at91_ivar *ivar;
kid = device_add_child_ordered(dev, prio, name, unit);
if (kid == NULL)
return;
if (kid == NULL) {
printf("Can't add child %s%d ordered\n", name, unit);
return;
}
ivar = malloc(sizeof(*ivar), M_DEVBUF, M_WAITOK | M_ZERO);
if (ivar == NULL) {
device_delete_child(dev, kid);
printf("Can't add alloc ivar\n");
return;
}
device_set_ivars(kid, ivar);