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
This commit is contained in:
Matt Jacob 2001-06-21 16:18:27 +00:00
parent b720900890
commit 0e300eff0a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=78555

View File

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