diff options
author | Jim Rees <rees@cvs.openbsd.org> | 1997-12-17 22:05:32 +0000 |
---|---|---|
committer | Jim Rees <rees@cvs.openbsd.org> | 1997-12-17 22:05:32 +0000 |
commit | 7c38b4c59a9d4c43dce9b2daed190794da47801f (patch) | |
tree | 27b59179599c90f201b86270c65a82fc26b84da4 /sys/arch/i386 | |
parent | 0017be07b227a275abf41142fe4d976530637595 (diff) |
set sc before checking in open et al
Diffstat (limited to 'sys/arch/i386')
-rw-r--r-- | sys/arch/i386/i386/apm.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/sys/arch/i386/i386/apm.c b/sys/arch/i386/i386/apm.c index 56dbc867f80..ebd8bc50c43 100644 --- a/sys/arch/i386/i386/apm.c +++ b/sys/arch/i386/i386/apm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: apm.c,v 1.18 1997/12/11 01:03:51 rees Exp $ */ +/* $OpenBSD: apm.c,v 1.19 1997/12/17 22:05:31 rees Exp $ */ /*- * Copyright (c) 1995 John T. Kohl. All rights reserved. @@ -750,11 +750,9 @@ apmopen(dev, flag, mode, p) struct apm_softc *sc; /* apm0 only */ - if (!apm_cd.cd_ndevs || APMUNIT(dev) != 0 || sc == NULL) + if (!apm_cd.cd_ndevs || APMUNIT(dev) != 0 || !(sc = apm_cd.cd_devs[APMUNIT(dev)])) return ENXIO; - sc = apm_cd.cd_devs[APMUNIT(dev)]; - switch (APMDEV(dev)) { case APMDEV_CTL: if (!(flag & FWRITE)) @@ -784,11 +782,9 @@ apmclose(dev, flag, mode, p) struct apm_softc *sc; /* apm0 only */ - if (!apm_cd.cd_ndevs || APMUNIT(dev) != 0 || sc == NULL) + if (!apm_cd.cd_ndevs || APMUNIT(dev) != 0 || !(sc = apm_cd.cd_devs[APMUNIT(dev)])) return ENXIO; - sc = apm_cd.cd_devs[APMUNIT(dev)]; - DPRINTF(("apmclose: pid %d flag %x mode %x\n", p->p_pid, flag, mode)); switch (APMDEV(dev)) { @@ -822,11 +818,9 @@ apmioctl(dev, cmd, data, flag, p) struct apm_ctl *actl; /* apm0 only */ - if (!apm_cd.cd_ndevs || APMUNIT(dev) != 0 || sc == NULL) + if (!apm_cd.cd_ndevs || APMUNIT(dev) != 0 || !(sc = apm_cd.cd_devs[APMUNIT(dev)])) return ENXIO; - sc = apm_cd.cd_devs[APMUNIT(dev)]; - switch (cmd) { /* some ioctl names from linux */ case APM_IOC_STANDBY: @@ -911,11 +905,9 @@ apmselect(dev, rw, p) struct apm_softc *sc; /* apm0 only */ - if (!apm_cd.cd_ndevs || APMUNIT(dev) != 0 || sc == NULL) + if (!apm_cd.cd_ndevs || APMUNIT(dev) != 0 || !(sc = apm_cd.cd_devs[APMUNIT(dev)])) return ENXIO; - sc = apm_cd.cd_devs[APMUNIT(dev)]; - switch (rw) { case FREAD: if (sc->event_count) |