tty_io: Use kzalloc
Also remove needless casts. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Alan Cox <alan@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
e8d6c55412
commit
506eb99a26
|
@ -2033,11 +2033,9 @@ static int init_dev(struct tty_driver *driver, int idx,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!*ltp_loc) {
|
if (!*ltp_loc) {
|
||||||
ltp = (struct ktermios *) kmalloc(sizeof(struct ktermios),
|
ltp = kzalloc(sizeof(struct ktermios), GFP_KERNEL);
|
||||||
GFP_KERNEL);
|
|
||||||
if (!ltp)
|
if (!ltp)
|
||||||
goto free_mem_out;
|
goto free_mem_out;
|
||||||
memset(ltp, 0, sizeof(struct ktermios));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (driver->type == TTY_DRIVER_TYPE_PTY) {
|
if (driver->type == TTY_DRIVER_TYPE_PTY) {
|
||||||
|
@ -2066,11 +2064,9 @@ static int init_dev(struct tty_driver *driver, int idx,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!*o_ltp_loc) {
|
if (!*o_ltp_loc) {
|
||||||
o_ltp = (struct ktermios *)
|
o_ltp = kzalloc(sizeof(struct ktermios), GFP_KERNEL);
|
||||||
kmalloc(sizeof(struct ktermios), GFP_KERNEL);
|
|
||||||
if (!o_ltp)
|
if (!o_ltp)
|
||||||
goto free_mem_out;
|
goto free_mem_out;
|
||||||
memset(o_ltp, 0, sizeof(struct ktermios));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -3755,9 +3751,8 @@ struct tty_driver *alloc_tty_driver(int lines)
|
||||||
{
|
{
|
||||||
struct tty_driver *driver;
|
struct tty_driver *driver;
|
||||||
|
|
||||||
driver = kmalloc(sizeof(struct tty_driver), GFP_KERNEL);
|
driver = kzalloc(sizeof(struct tty_driver), GFP_KERNEL);
|
||||||
if (driver) {
|
if (driver) {
|
||||||
memset(driver, 0, sizeof(struct tty_driver));
|
|
||||||
driver->magic = TTY_DRIVER_MAGIC;
|
driver->magic = TTY_DRIVER_MAGIC;
|
||||||
driver->num = lines;
|
driver->num = lines;
|
||||||
/* later we'll move allocation of tables here */
|
/* later we'll move allocation of tables here */
|
||||||
|
|
Loading…
Reference in New Issue