Initialize sc_iot early enough to avoid a crash when the hardware monitor

function was found disabled.
This commit is contained in:
phx 2010-12-10 21:20:09 +00:00
parent f360555e8a
commit 2022dcaf61
1 changed files with 4 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: viaenv.c,v 1.29 2008/04/30 14:07:14 ad Exp $ */
/* $NetBSD: viaenv.c,v 1.30 2010/12/10 21:20:09 phx Exp $ */
/*
* Copyright (c) 2000 Johan Danielsson
@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: viaenv.c,v 1.29 2008/04/30 14:07:14 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: viaenv.c,v 1.30 2010/12/10 21:20:09 phx Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -295,6 +295,8 @@ viaenv_attach(device_t parent, device_t self, void *aux)
break;
}
sc->sc_iot = pa->pa_iot;
iobase = pci_conf_read(pa->pa_pc, pa->pa_tag, VIAENV_HWMON_CONF);
DPRINTF(("%s: iobase 0x%x\n", device_xname(self), iobase));
control = pci_conf_read(pa->pa_pc, pa->pa_tag, VIAENV_HWMON_CTL);
@ -306,7 +308,6 @@ viaenv_attach(device_t parent, device_t self, void *aux)
}
/* Map Hardware Monitor I/O space */
sc->sc_iot = pa->pa_iot;
if (bus_space_map(sc->sc_iot, iobase & 0xff80,
VIAENV_PMSIZE, 0, &sc->sc_ioh)) {
aprint_error_dev(self, "failed to map I/O space\n");