svn commit: r209485 - head/sys/powerpc/powerpc
Marcel Moolenaar
marcel at FreeBSD.org
Wed Jun 23 22:25:53 UTC 2010
Author: marcel
Date: Wed Jun 23 22:25:52 2010
New Revision: 209485
URL: http://svn.freebsd.org/changeset/base/209485
Log:
In the attach method, refactor to take into account that
BUS_GET_RESOURCE_LIST() can return a NULL pointer -- and
will for MPC85xx kernels.
Modified:
head/sys/powerpc/powerpc/openpic.c
Modified: head/sys/powerpc/powerpc/openpic.c
==============================================================================
--- head/sys/powerpc/powerpc/openpic.c Wed Jun 23 20:59:00 2010 (r209484)
+++ head/sys/powerpc/powerpc/openpic.c Wed Jun 23 22:25:52 2010 (r209485)
@@ -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);
More information about the svn-src-head
mailing list