summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2008-08-23 07:23:52 +0000
committerimp <imp@FreeBSD.org>2008-08-23 07:23:52 +0000
commit0f3a30fb7ac195b316b1f584672db14e51cad9cc (patch)
tree1f792d0b97769f2d21a3b0c8c9c5fabdf27cf20a
parent5c0481577ec701349379f5bd6f5428e18bfbb24a (diff)
downloadFreeBSD-src-0f3a30fb7ac195b316b1f584672db14e51cad9cc.zip
FreeBSD-src-0f3a30fb7ac195b316b1f584672db14e51cad9cc.tar.gz
Cope with errors from device_get_children(). These errors can happen
only in low memory situations, so the error fork of these fixes is lightly tested, but they should do the least-wrong thing... Submitted by: Hans Petter Selasky
-rw-r--r--sys/dev/pci/pci.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c
index 81ef5a5..9203867 100644
--- a/sys/dev/pci/pci.c
+++ b/sys/dev/pci/pci.c
@@ -2663,7 +2663,8 @@ pci_suspend(device_t dev)
acpi_dev = NULL;
if (pci_do_power_resume)
acpi_dev = devclass_get_device(devclass_find("acpi"), 0);
- device_get_children(dev, &devlist, &numdevs);
+ if ((error = device_get_children(dev, &devlist, &numdevs)) != 0)
+ return (error);
for (i = 0; i < numdevs; i++) {
child = devlist[i];
dinfo = (struct pci_devinfo *) device_get_ivars(child);
@@ -2700,7 +2701,7 @@ pci_suspend(device_t dev)
int
pci_resume(device_t dev)
{
- int i, numdevs;
+ int i, numdevs, error;
device_t acpi_dev, child, *devlist;
struct pci_devinfo *dinfo;
@@ -2710,7 +2711,8 @@ pci_resume(device_t dev)
acpi_dev = NULL;
if (pci_do_power_resume)
acpi_dev = devclass_get_device(devclass_find("acpi"), 0);
- device_get_children(dev, &devlist, &numdevs);
+ if ((error = device_get_children(dev, &devlist, &numdevs)) != 0)
+ return (error);
for (i = 0; i < numdevs; i++) {
/*
* Notify ACPI we're going to D0 but ignore the result. If
@@ -2759,7 +2761,8 @@ pci_driver_added(device_t dev, driver_t *driver)
if (bootverbose)
device_printf(dev, "driver added\n");
DEVICE_IDENTIFY(driver, dev);
- device_get_children(dev, &devlist, &numdevs);
+ if (device_get_children(dev, &devlist, &numdevs) != 0)
+ return;
for (i = 0; i < numdevs; i++) {
child = devlist[i];
if (device_get_state(child) != DS_NOTPRESENT)
OpenPOWER on IntegriCloud