From 7e2ff8bbff073b8f2d10ad9d4f1929e66f16395d Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Fri, 19 Jan 2007 08:49:28 +0000 Subject: [PATCH] Cope gracefully with device_get_children returning an error. Obtained from: Hans Petter Selasky P4: http://perforce.freebsd.org/chv.cgi?CH=112957 --- sys/dev/cardbus/cardbus.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sys/dev/cardbus/cardbus.c b/sys/dev/cardbus/cardbus.c index 2e3453eaccb..bd2b31c591a 100644 --- a/sys/dev/cardbus/cardbus.c +++ b/sys/dev/cardbus/cardbus.c @@ -217,7 +217,8 @@ cardbus_detach_card(device_t cbdev) int tmp; int err = 0; - device_get_children(cbdev, &devlist, &numdevs); + if (device_get_children(cbdev, &devlist, &numdevs) != 0) + return (ENOENT); if (numdevs == 0) { free(devlist, M_TEMP); @@ -251,7 +252,9 @@ cardbus_driver_added(device_t cbdev, driver_t *driver) struct cardbus_devinfo *dinfo; DEVICE_IDENTIFY(driver, cbdev); - device_get_children(cbdev, &devlist, &numdevs); + if (device_get_children(cbdev, &devlist, &numdevs) != 0) + return; + /* * If there are no drivers attached, but there are children, * then power the card up.