diff options
| author | Andrew Turner <andrew@FreeBSD.org> | 2020-07-01 12:07:28 +0000 |
|---|---|---|
| committer | Andrew Turner <andrew@FreeBSD.org> | 2020-07-01 12:07:28 +0000 |
| commit | ecc8ccb44180ed9916e830baf2d9ef7d911e051a (patch) | |
| tree | f4526ae3d80c95468377dcb4f8c6b7cb1e28dbb6 /sys | |
| parent | 6d76adbb6d82c78d2785d0ebad13227612a817db (diff) | |
Notes
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/kern/subr_intr.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/sys/kern/subr_intr.c b/sys/kern/subr_intr.c index 4c3c0224559e..eda100164711 100644 --- a/sys/kern/subr_intr.c +++ b/sys/kern/subr_intr.c @@ -1517,13 +1517,12 @@ intr_map_get_isrc(u_int res_id) { struct intr_irqsrc *isrc; + isrc = NULL; mtx_lock(&irq_map_lock); - if ((res_id >= irq_map_count) || (irq_map[res_id] == NULL)) { - mtx_unlock(&irq_map_lock); - return (NULL); - } - isrc = irq_map[res_id]->isrc; + if (res_id < irq_map_count && irq_map[res_id] != NULL) + isrc = irq_map[res_id]->isrc; mtx_unlock(&irq_map_lock); + return (isrc); } @@ -1532,11 +1531,8 @@ intr_map_set_isrc(u_int res_id, struct intr_irqsrc *isrc) { mtx_lock(&irq_map_lock); - if ((res_id >= irq_map_count) || (irq_map[res_id] == NULL)) { - mtx_unlock(&irq_map_lock); - return; - } - irq_map[res_id]->isrc = isrc; + if (res_id < irq_map_count && irq_map[res_id] != NULL) + irq_map[res_id]->isrc = isrc; mtx_unlock(&irq_map_lock); } |
