diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-01-06 12:57:17 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-01-06 12:57:17 +0000 |
commit | 15ccd4fe5f911400054371f9c10f51a7868f3f60 (patch) | |
tree | ee945be7d02f9682e7b8e99d4a4b1463ff638d5e /sys/arch | |
parent | 0c9a76a797c63e71ea3ff38940ac368e14ac6687 (diff) |
by mrg and myself on irc: fix a ttymalloc() memory leak, TIOCM* botch
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/sparc/dev/zs.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/sys/arch/sparc/dev/zs.c b/sys/arch/sparc/dev/zs.c index bfe7ae9c825..d8e50c1b397 100644 --- a/sys/arch/sparc/dev/zs.c +++ b/sys/arch/sparc/dev/zs.c @@ -276,7 +276,6 @@ zsattach(parent, dev, aux) cs[1].cs_sc = sc; zslist = cs; - cs->cs_ttyp = tp = ttymalloc(); cs->cs_unit = unit; cs->cs_speed = zs_getspeed(&addr->zs_chan[ZS_CHAN_A]); cs->cs_zc = &addr->zs_chan[ZS_CHAN_A]; @@ -284,7 +283,9 @@ zsattach(parent, dev, aux) tp->t_oproc = zsstart; tp->t_param = zsparam; if ((ctp = zs_checkcons(sc, unit, cs)) != NULL) - cs->cs_ttyp = tp = ctp; + tp = ctp; + else + tp = ttymalloc(); cs->cs_ttyp = tp; #ifdef KGDB if (ctp == NULL) @@ -306,7 +307,7 @@ zsattach(parent, dev, aux) M_DEVBUF, M_NOWAIT); unit++; cs++; - cs->cs_ttyp = tp = ttymalloc(); + cs->cs_unit = unit; cs->cs_speed = zs_getspeed(&addr->zs_chan[ZS_CHAN_B]); cs->cs_zc = &addr->zs_chan[ZS_CHAN_B]; @@ -314,7 +315,11 @@ zsattach(parent, dev, aux) tp->t_oproc = zsstart; tp->t_param = zsparam; if ((ctp = zs_checkcons(sc, unit, cs)) != NULL) - cs->cs_ttyp = tp = ctp; + tp = ctp; + else + tp = ttymalloc(); + cs->cs_ttyp = tp; + #ifdef KGDB if (ctp == NULL) zs_checkkgdb(unit, cs, tp); @@ -821,7 +826,7 @@ zsrint(cs, zc) register struct zs_chanstate *cs; register volatile struct zschan *zc; { - register int c; + register u_int c; c = zc->zc_data; ZS_DELAY(); @@ -903,7 +908,7 @@ zssint(cs, zc) register struct zs_chanstate *cs; register volatile struct zschan *zc; { - register int rr0; + register u_int rr0; rr0 = zc->zc_csr; ZS_DELAY(); @@ -1225,11 +1230,11 @@ zsioctl(dev, cmd, data, flag, p) break; case TIOCMGET: /* XXX: fixme */ - zs_modem(cs, *(int *)data & (TIOCM_DTR|TIOCM_RTS)); + *(int *)data = TIOCM_CAR | TIOCM_CTS | TIOCM_DTR | TIOCM_RTS; return (0); case TIOCMSET: /* XXX: fixme */ - *(int *)data = TIOCM_CAR | TIOCM_CTS | TIOCM_DTR | TIOCM_RTS; + zs_modem(cs, *(int *)data & (TIOCM_DTR|TIOCM_RTS)); return (0); case TIOCMBIS: case TIOCMBIC: |