In the attach method, refactor to take into account that

BUS_GET_RESOURCE_LIST() can return a NULL pointer -- and
will for MPC85xx kernels.
This commit is contained in:
Marcel Moolenaar 2010-06-23 22:25:52 +00:00
parent 595473a587
commit bd077006c0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=209485

View File

@ -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);