diff options
author | marcel <marcel@FreeBSD.org> | 2010-06-23 22:25:52 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2010-06-23 22:25:52 +0000 |
commit | 9f1a0b6386f1d24c42f4060d8550ee46b014b2ec (patch) | |
tree | 943e05dd428d41a4d3134b32bd3a90f1cead6c9a | |
parent | 8dcd1daee8fe0803727673a014545c545bf684e4 (diff) | |
download | FreeBSD-src-9f1a0b6386f1d24c42f4060d8550ee46b014b2ec.zip FreeBSD-src-9f1a0b6386f1d24c42f4060d8550ee46b014b2ec.tar.gz |
In the attach method, refactor to take into account that
BUS_GET_RESOURCE_LIST() can return a NULL pointer -- and
will for MPC85xx kernels.
-rw-r--r-- | sys/powerpc/powerpc/openpic.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/sys/powerpc/powerpc/openpic.c b/sys/powerpc/powerpc/openpic.c index 0b98964..eca7947 100644 --- a/sys/powerpc/powerpc/openpic.c +++ b/sys/powerpc/powerpc/openpic.c @@ -114,15 +114,22 @@ openpic_attach(device_t dev) /* Check if this is a cascaded PIC */ sc->sc_irq = 0; sc->sc_intr = NULL; - if (resource_list_find(BUS_GET_RESOURCE_LIST(device_get_parent(dev), - dev), SYS_RES_IRQ, 0) != NULL) { + do { + struct resource_list *rl; + + rl = BUS_GET_RESOURCE_LIST(device_get_parent(dev), dev); + if (rl == NULL) + break; + if (resource_list_find(rl, SYS_RES_IRQ, 0) == NULL) + break; + sc->sc_intr = bus_alloc_resource_any(dev, SYS_RES_IRQ, &sc->sc_irq, RF_ACTIVE); /* XXX Cascaded PICs pass NULL trapframes! */ bus_setup_intr(dev, sc->sc_intr, INTR_TYPE_MISC | INTR_MPSAFE, openpic_intr, NULL, dev, &sc->sc_icookie); - } + } while (0); /* Reset the PIC */ x = openpic_read(sc, OPENPIC_CONFIG); |