summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormjacob <mjacob@FreeBSD.org>2001-06-21 16:18:27 +0000
committermjacob <mjacob@FreeBSD.org>2001-06-21 16:18:27 +0000
commit365007e4cbe915c6b393123e78fe6557a38f5b4e (patch)
treed404340d58c14bdd9ecf303604c2f9d5aaa855b6
parentfbbff0939b11e073af8eb011e1568796b043caed (diff)
downloadFreeBSD-src-365007e4cbe915c6b393123e78fe6557a38f5b4e.zip
FreeBSD-src-365007e4cbe915c6b393123e78fe6557a38f5b4e.tar.gz
Don't dereference NULL regs pointer (should mapping I/O ports fail, as
they did for me on an alpha) Approved by: gibbs@freebsd.org MFC after: 2 days
-rw-r--r--sys/dev/aic7xxx/ahc_pci.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/sys/dev/aic7xxx/ahc_pci.c b/sys/dev/aic7xxx/ahc_pci.c
index 9968570..01772a0 100644
--- a/sys/dev/aic7xxx/ahc_pci.c
+++ b/sys/dev/aic7xxx/ahc_pci.c
@@ -182,12 +182,13 @@ ahc_pci_map_registers(struct ahc_softc *ahc)
regs_id = AHC_PCI_IOADDR;
regs = bus_alloc_resource(ahc->dev_softc, regs_type,
&regs_id, 0, ~0, 1, RF_ACTIVE);
- ahc->tag = rman_get_bustag(regs);
- ahc->bsh = rman_get_bushandle(regs);
- command &= ~PCIM_CMD_MEMEN;
- ahc_pci_write_config(ahc->dev_softc,
- PCIR_COMMAND,
- command, /*bytes*/1);
+ if (regs) {
+ ahc->tag = rman_get_bustag(regs);
+ ahc->bsh = rman_get_bushandle(regs);
+ command &= ~PCIM_CMD_MEMEN;
+ ahc_pci_write_config(ahc->dev_softc, PCIR_COMMAND,
+ command, /*bytes*/1);
+ }
}
ahc->platform_data->regs_res_type = regs_type;
ahc->platform_data->regs_res_id = regs_id;
OpenPOWER on IntegriCloud