diff options
author | imp <imp@FreeBSD.org> | 2003-04-08 07:05:16 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 2003-04-08 07:05:16 +0000 |
commit | bc776ad450a8c74f9c91d1012c0a938a06fa1e09 (patch) | |
tree | b8c27660b6e254827e6457ada5c03b653adbb13d | |
parent | 5f6f6eb722576dc880910c6ed8a8cdb2704d1628 (diff) | |
download | FreeBSD-src-bc776ad450a8c74f9c91d1012c0a938a06fa1e09.zip FreeBSD-src-bc776ad450a8c74f9c91d1012c0a938a06fa1e09.tar.gz |
MFp4: when you can't allocate a resource, print a message, don't panic.
-rw-r--r-- | sys/dev/cardbus/cardbus_cis.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/sys/dev/cardbus/cardbus_cis.c b/sys/dev/cardbus/cardbus_cis.c index adee34d..73cda20 100644 --- a/sys/dev/cardbus/cardbus_cis.c +++ b/sys/dev/cardbus/cardbus_cis.c @@ -849,6 +849,11 @@ cardbus_alloc_resources(device_t cbdev, device_t child) res = bus_alloc_resource(cbdev, SYS_RES_MEMORY, &rid, 0, (dinfo->mprefetchable & dinfo->mbelow1mb)?0xFFFFF:~0UL, mem_psize, flags); + if (res == NULL) { + device_printf(cbdev, + "Can't get memory for prefetch mem\n"); + return (EIO); + } start = rman_get_start(res); end = rman_get_end(res); DEVPRINTF((cbdev, "Prefetchable memory at %x-%x\n", start, end)); @@ -890,6 +895,11 @@ cardbus_alloc_resources(device_t cbdev, device_t child) res = bus_alloc_resource(cbdev, SYS_RES_MEMORY, &rid, 0, ((~dinfo->mprefetchable) & dinfo->mbelow1mb)?0xFFFFF:~0UL, mem_nsize, flags); + if (res == NULL) { + device_printf(cbdev, + "Can't get memory for non-prefetch mem\n"); + return (EIO); + } start = rman_get_start(res); end = rman_get_end(res); DEVPRINTF((cbdev, "Non-prefetchable memory at %x-%x\n", @@ -930,6 +940,11 @@ cardbus_alloc_resources(device_t cbdev, device_t child) rid = 0; res = bus_alloc_resource(cbdev, SYS_RES_IOPORT, &rid, 0, (dinfo->ibelow1mb)?0xFFFFF:~0UL, io_size, flags); + if (res == NULL) { + device_printf(cbdev, + "Can't get memory for IO ports\n"); + return (EIO); + } start = rman_get_start(res); end = rman_get_end(res); DEVPRINTF((cbdev, "IO port at %x-%x\n", start, end)); @@ -951,6 +966,10 @@ cardbus_alloc_resources(device_t cbdev, device_t child) rid = 0; res = bus_alloc_resource(cbdev, SYS_RES_IRQ, &rid, 0, ~0UL, 1, RF_SHAREABLE); + if (res == NULL) { + device_printf(cbdev, "Can't get memory for irq\n"); + return (EIO); + } start = rman_get_start(res); end = rman_get_end(res); bus_release_resource(cbdev, SYS_RES_IRQ, rid, res); |