MFp4: when passing the transfer up the foodchain, make sure we go up

the food chain.  devi == NULL is the error condition.  Treat it as such.
This commit is contained in:
Warner Losh 2006-10-20 07:11:52 +00:00
parent 0f1c5aca64
commit 86663fabdd
1 changed files with 4 additions and 2 deletions

View File

@ -136,8 +136,10 @@ spibus_add_child(device_t dev, int order, const char *name, int unit)
if (child == NULL) if (child == NULL)
return (child); return (child);
devi = malloc(sizeof(struct spibus_ivar), M_DEVBUF, M_NOWAIT | M_ZERO); devi = malloc(sizeof(struct spibus_ivar), M_DEVBUF, M_NOWAIT | M_ZERO);
if (devi != NULL) if (devi == NULL) {
device_delete_child(dev, child);
return (0); return (0);
}
device_set_ivars(child, devi); device_set_ivars(child, devi);
return (child); return (child);
} }
@ -156,7 +158,7 @@ spibus_hinted_child(device_t bus, const char *dname, int dunit)
static int static int
spibus_transfer_impl(device_t dev, device_t child, struct spi_command *cmd) spibus_transfer_impl(device_t dev, device_t child, struct spi_command *cmd)
{ {
return (SPIBUS_TRANSFER(dev, child, cmd)); return (SPIBUS_TRANSFER(device_get_parent(dev), child, cmd));
} }
static device_method_t spibus_methods[] = { static device_method_t spibus_methods[] = {