summaryrefslogtreecommitdiffstats
path: root/sys/i386/isa/psm.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1996-11-28 17:18:56 +0000
committerphk <phk@FreeBSD.org>1996-11-28 17:18:56 +0000
commit33855a25bd0ba181c3b93e6fccb308764fa02a17 (patch)
tree9b04f6dfae028643999e1a5421b637188b80be14 /sys/i386/isa/psm.c
parent6f6b1023c0a37d1d3d84d6eda63b4fa5e4b28fb5 (diff)
downloadFreeBSD-src-33855a25bd0ba181c3b93e6fccb308764fa02a17.zip
FreeBSD-src-33855a25bd0ba181c3b93e6fccb308764fa02a17.tar.gz
I broke psm.c and none of the 5 reviewers noticed :-)
Diffstat (limited to 'sys/i386/isa/psm.c')
-rw-r--r--sys/i386/isa/psm.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/sys/i386/isa/psm.c b/sys/i386/isa/psm.c
index bcb5828..2e11729 100644
--- a/sys/i386/isa/psm.c
+++ b/sys/i386/isa/psm.c
@@ -19,7 +19,7 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: psm.c,v 1.29 1996/11/15 17:30:29 nate Exp $
+ * $Id: psm.c,v 1.30 1996/11/27 22:52:25 phk Exp $
*/
/*
@@ -433,7 +433,10 @@ psmprobe(struct isa_device *dvp)
if (unit >= NPSM)
return (0);
- sc = psm_softc[unit];
+ sc = malloc(sizeof *sc, M_DEVBUF, M_NOWAIT);
+
+ bzero(sc, sizeof *sc);
+
sc->addr = ioport;
if (bootverbose)
++verbose;
@@ -487,6 +490,7 @@ psmprobe(struct isa_device *dvp)
if (sc->command_byte == -1) {
printf("psm%d: unable to get the current command byte value.\n",
unit);
+ free(sc, M_DEVBUF);
return (0);
}
@@ -524,6 +528,7 @@ psmprobe(struct isa_device *dvp)
unit, i);
if (bootverbose)
--verbose;
+ free(sc, M_DEVBUF);
return (0);
}
@@ -536,6 +541,7 @@ psmprobe(struct isa_device *dvp)
restore_controller(ioport, sc->command_byte);
if (verbose)
printf("psm%d: failed to reset the aux device.\n", unit);
+ free(sc, M_DEVBUF);
return (0);
}
/*
@@ -550,6 +556,7 @@ psmprobe(struct isa_device *dvp)
printf("psm%d: failed to enable the aux device.\n", unit);
if (bootverbose)
--verbose;
+ free(sc, M_DEVBUF);
return (0);
}
empty_both_buffers(ioport); /* remove stray data if any */
@@ -565,6 +572,7 @@ psmprobe(struct isa_device *dvp)
printf("psm%d: unknown device type (%d).\n", unit, sc->hw.hwid);
if (bootverbose)
--verbose;
+ free(sc, M_DEVBUF);
return (0);
}
switch (sc->hw.hwid) {
@@ -613,6 +621,7 @@ psmprobe(struct isa_device *dvp)
KBD_DISABLE_AUX_PORT | KBD_DISABLE_AUX_INT);
/* done */
+ psm_softc[unit] = sc;
return (IO_PSMSIZE);
}
@@ -620,10 +629,7 @@ static int
psmattach(struct isa_device *dvp)
{
int unit = dvp->id_unit;
- struct psm_softc *sc = psm_softc[unit] =
- malloc(sizeof *sc, M_DEVBUF, M_NOWAIT);
-
- bzero(sc, sizeof *sc);
+ struct psm_softc *sc = psm_softc[unit];
/* initial operation mode */
sc->mode.accelfactor = PSM_ACCEL;
OpenPOWER on IntegriCloud