diff options
author | marcel <marcel@FreeBSD.org> | 2006-05-02 23:27:15 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2006-05-02 23:27:15 +0000 |
commit | 04815f85302749e1f7458825e3ff1e8119515672 (patch) | |
tree | 168eb7a97b14efe17b52bf371bf28581642cf2e3 /sys/alpha | |
parent | 90151bff3d423ce26ae4898fb406e1c64b4e5ff2 (diff) | |
download | FreeBSD-src-04815f85302749e1f7458825e3ff1e8119515672.zip FreeBSD-src-04815f85302749e1f7458825e3ff1e8119515672.tar.gz |
Fix previous commit: the resource returned by rman_reserve_resource()
can be NULL. Make sure to only call rman_set_rid() when the resource
is not NULL. While here, improve readability and style.
Diffstat (limited to 'sys/alpha')
-rw-r--r-- | sys/alpha/isa/isa.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/sys/alpha/isa/isa.c b/sys/alpha/isa/isa.c index e262bab..36b23d4 100644 --- a/sys/alpha/isa/isa.c +++ b/sys/alpha/isa/isa.c @@ -224,23 +224,21 @@ isa_alloc_resource(device_t bus, device_t child, int type, int *rid, } } - if (type == SYS_RES_IRQ) - res = rman_reserve_resource(&isa_irq_rman, start, start, 1, - 0, child); - else - res = rman_reserve_resource(&isa_drq_rman, start, start, 1, - 0, child); - + res = rman_reserve_resource( + (type == SYS_RES_IRQ) ? &isa_irq_rman : &isa_drq_rman, + start, start, 1, 0, child); + if (res == NULL) + return (NULL); + rman_set_rid(res, *rid); - if (res && !passthrough) { + if (!passthrough) { rle = resource_list_find(rl, type, *rid); rle->start = rman_get_start(res); rle->end = rman_get_end(res); rle->count = 1; rle->res = res; } - - return res; + return (res); } int |