diff options
author | imp <imp@FreeBSD.org> | 2006-10-20 07:11:52 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 2006-10-20 07:11:52 +0000 |
commit | 8c0a0fd0aa2605ddb0d8631bd741ae3bd104a46d (patch) | |
tree | 3e943efde6cff3d95296e4609e761c43b3c50db1 /sys/dev/spibus | |
parent | c24d0dcbc67d3f8faf9d010b95211d3af647ef2c (diff) | |
download | FreeBSD-src-8c0a0fd0aa2605ddb0d8631bd741ae3bd104a46d.zip FreeBSD-src-8c0a0fd0aa2605ddb0d8631bd741ae3bd104a46d.tar.gz |
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.
Diffstat (limited to 'sys/dev/spibus')
-rw-r--r-- | sys/dev/spibus/spibus.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/dev/spibus/spibus.c b/sys/dev/spibus/spibus.c index 6a5ab70..76b4a8c 100644 --- a/sys/dev/spibus/spibus.c +++ b/sys/dev/spibus/spibus.c @@ -136,8 +136,10 @@ spibus_add_child(device_t dev, int order, const char *name, int unit) if (child == NULL) return (child); 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); + } device_set_ivars(child, devi); return (child); } @@ -156,7 +158,7 @@ spibus_hinted_child(device_t bus, const char *dname, int dunit) static int 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[] = { |