diff options
author | Warner Losh <imp@FreeBSD.org> | 2008-08-23 07:38:00 +0000 |
---|---|---|
committer | Warner Losh <imp@FreeBSD.org> | 2008-08-23 07:38:00 +0000 |
commit | da02572e7fbd8cc8e1055e935c48d6e9957db107 (patch) | |
tree | 88666ccee3162dea2f0d4b6a5ac3f2b0c621d98e /sys/dev/iicbus | |
parent | 696771ee0a52761f0d5cd47b1fb66f6f7914302f (diff) | |
download | src-da02572e7fbd8cc8e1055e935c48d6e9957db107.tar.gz src-da02572e7fbd8cc8e1055e935c48d6e9957db107.zip |
Handle errors from device_get_chidlren.
Free child list when there's more children than we expected.
Notes
Notes:
svn path=/head/; revision=182034
Diffstat (limited to 'sys/dev/iicbus')
-rw-r--r-- | sys/dev/iicbus/iiconf.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/dev/iicbus/iiconf.c b/sys/dev/iicbus/iiconf.c index bf7f4533e229..1610b351e745 100644 --- a/sys/dev/iicbus/iiconf.c +++ b/sys/dev/iicbus/iiconf.c @@ -366,9 +366,12 @@ iicbus_transfer_gen(device_t dev, struct iic_msg *msgs, uint32_t nmsgs) int i, error, lenread, lenwrote, nkid; device_t *children, bus; - device_get_children(dev, &children, &nkid); - if (nkid != 1) + if ((error = device_get_children(dev, &children, &nkid)) != 0) + return (error); + if (nkid != 1) { + free(children, M_TEMP); return (EIO); + } bus = children[0]; free(children, M_TEMP); for (i = 0, error = 0; i < nmsgs && error == 0; i++) { |