Always initialize master_softc. This avoids panics in the idle loop due

to unitialized data if the APM support is compiled in and the probe
fails.
This commit is contained in:
Nate Williams 1996-03-12 06:09:34 +00:00
parent 638f228080
commit b079435208
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=14581
2 changed files with 14 additions and 4 deletions

View File

@ -13,7 +13,7 @@
*
* Sep, 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD)
*
* $Id: apm.c,v 1.23 1995/12/27 16:16:02 bde Exp $
* $Id: apm.c,v 1.24 1996/03/11 06:48:48 nate Exp $
*/
#include "apm.h"
@ -604,6 +604,12 @@ apmprobe(struct isa_device *dvp)
{
int unit = dvp->id_unit;
/*
* XXX - This is necessary here so that we don't panic in the idle
* loop because master_softc is unitialized.
*/
master_softc = &apm_softc[unit];
switch (apm_version) {
case APMINI_CANTFIND:
/* silent */
@ -712,7 +718,6 @@ apmattach(struct isa_device *dvp)
#define APM_KERNBASE KERNBASE
struct apm_softc *sc = &apm_softc[unit];
master_softc = sc; /* XXX */
sc->initialized = 0;
sc->active = 0;
sc->halt_cpu = 1;

View File

@ -13,7 +13,7 @@
*
* Sep, 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD)
*
* $Id: apm.c,v 1.23 1995/12/27 16:16:02 bde Exp $
* $Id: apm.c,v 1.24 1996/03/11 06:48:48 nate Exp $
*/
#include "apm.h"
@ -604,6 +604,12 @@ apmprobe(struct isa_device *dvp)
{
int unit = dvp->id_unit;
/*
* XXX - This is necessary here so that we don't panic in the idle
* loop because master_softc is unitialized.
*/
master_softc = &apm_softc[unit];
switch (apm_version) {
case APMINI_CANTFIND:
/* silent */
@ -712,7 +718,6 @@ apmattach(struct isa_device *dvp)
#define APM_KERNBASE KERNBASE
struct apm_softc *sc = &apm_softc[unit];
master_softc = sc; /* XXX */
sc->initialized = 0;
sc->active = 0;
sc->halt_cpu = 1;