mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-21 15:45:02 +00:00
M_TTYS -> M_DEVBUF. M_TTYS is documented to be for "tty data
structures" but since tty structs aren't malloced it is actually mainly for tty-level (clist) buffers. It was slightly misused here for com structs, and the previous commit completely misused it for device buffers. Fixed some bugs in nearby pccard code: - memory leak when pccards go away (broken in previous commit). - bogus bzeroing of the com struct before freeing it. - style bugs.
This commit is contained in:
parent
1e476c296d
commit
d95f2350b0
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=43610
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)com.c 7.5 (Berkeley) 5/16/91
|
||||
* $Id: sio.c,v 1.226 1999/01/30 12:17:34 phk Exp $
|
||||
* $Id: sio.c,v 1.227 1999/02/04 13:45:14 bde Exp $
|
||||
*/
|
||||
|
||||
#include "opt_comconsole.h"
|
||||
@ -517,8 +517,9 @@ siounload(struct pccard_devinfo *devi)
|
||||
ttwwakeup(com->tp);
|
||||
} else {
|
||||
com_addr(com->unit) = NULL;
|
||||
bzero(com, sizeof *com);
|
||||
free(com,M_TTYS);
|
||||
if (com->ibuf != NULL)
|
||||
free(com->ibuf, M_DEVBUF);
|
||||
free(com, M_DEVBUF);
|
||||
printf("sio%d: unload,gone\n", devi->isahd.id_unit);
|
||||
}
|
||||
}
|
||||
@ -861,7 +862,7 @@ sioattach(isdp)
|
||||
isdp->id_ri_flags |= RI_FAST;
|
||||
iobase = isdp->id_iobase;
|
||||
unit = isdp->id_unit;
|
||||
com = malloc(sizeof *com, M_TTYS, M_NOWAIT);
|
||||
com = malloc(sizeof *com, M_DEVBUF, M_NOWAIT);
|
||||
if (com == NULL)
|
||||
return (0);
|
||||
|
||||
@ -919,7 +920,7 @@ sioattach(isdp)
|
||||
com->it_in.c_ispeed = com->it_in.c_ospeed = TTYDEF_SPEED;
|
||||
if (siosetwater(com, com->it_in.c_ispeed) != 0) {
|
||||
enable_intr();
|
||||
free(com, M_TTYS);
|
||||
free(com, M_DEVBUF);
|
||||
return (0);
|
||||
}
|
||||
enable_intr();
|
||||
@ -1289,10 +1290,11 @@ sioclose(dev, flag, mode, p)
|
||||
if (com->gone) {
|
||||
printf("sio%d: gone\n", com->unit);
|
||||
s = spltty();
|
||||
com_addr(com->unit) = 0;
|
||||
bzero(tp,sizeof *tp);
|
||||
bzero(com,sizeof *com);
|
||||
free(com,M_TTYS);
|
||||
com_addr(com->unit) = NULL;
|
||||
if (com->ibuf != NULL)
|
||||
free(com->ibuf, M_DEVBUF);
|
||||
bzero(tp, sizeof *tp);
|
||||
free(com, M_DEVBUF);
|
||||
splx(s);
|
||||
}
|
||||
return (0);
|
||||
@ -2144,7 +2146,7 @@ comparam(tp, t)
|
||||
splx(s);
|
||||
comstart(tp);
|
||||
if (com->ibufold != NULL) {
|
||||
free(com->ibufold, M_TTYS);
|
||||
free(com->ibufold, M_DEVBUF);
|
||||
com->ibufold = NULL;
|
||||
}
|
||||
return (0);
|
||||
@ -2178,7 +2180,7 @@ siosetwater(com, speed)
|
||||
* Allocate input buffer. The extra factor of 2 in the size is
|
||||
* to allow for an error byte for each input byte.
|
||||
*/
|
||||
ibuf = malloc(2 * ibufsize, M_TTYS, M_NOWAIT);
|
||||
ibuf = malloc(2 * ibufsize, M_DEVBUF, M_NOWAIT);
|
||||
if (ibuf == NULL) {
|
||||
disable_intr();
|
||||
return (ENOMEM);
|
||||
|
Loading…
Reference in New Issue
Block a user