diff options
author | Jean Delvare <khali@linux-fr.org> | 2007-07-16 02:40:14 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-16 12:05:43 -0400 |
commit | 506eb99a26e7af8b649faa135f648d1a2f1e4cdc (patch) | |
tree | 65cad159d4d16408d6fc5415a9ba9a0649c3be36 /drivers/char/tty_io.c | |
parent | e8d6c554126b830217c5e9f549e0e21f865a0a8a (diff) |
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>
Diffstat (limited to 'drivers/char/tty_io.c')
-rw-r--r-- | drivers/char/tty_io.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index a37e6330db8a..fde69e589ca7 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c | |||
@@ -2033,11 +2033,9 @@ static int init_dev(struct tty_driver *driver, int idx, | |||
2033 | } | 2033 | } |
2034 | 2034 | ||
2035 | if (!*ltp_loc) { | 2035 | if (!*ltp_loc) { |
2036 | ltp = (struct ktermios *) kmalloc(sizeof(struct ktermios), | 2036 | ltp = kzalloc(sizeof(struct ktermios), GFP_KERNEL); |
2037 | GFP_KERNEL); | ||
2038 | if (!ltp) | 2037 | if (!ltp) |
2039 | goto free_mem_out; | 2038 | goto free_mem_out; |
2040 | memset(ltp, 0, sizeof(struct ktermios)); | ||
2041 | } | 2039 | } |
2042 | 2040 | ||
2043 | if (driver->type == TTY_DRIVER_TYPE_PTY) { | 2041 | if (driver->type == TTY_DRIVER_TYPE_PTY) { |
@@ -2066,11 +2064,9 @@ static int init_dev(struct tty_driver *driver, int idx, | |||
2066 | } | 2064 | } |
2067 | 2065 | ||
2068 | if (!*o_ltp_loc) { | 2066 | if (!*o_ltp_loc) { |
2069 | o_ltp = (struct ktermios *) | 2067 | o_ltp = kzalloc(sizeof(struct ktermios), GFP_KERNEL); |
2070 | kmalloc(sizeof(struct ktermios), GFP_KERNEL); | ||
2071 | if (!o_ltp) | 2068 | if (!o_ltp) |
2072 | goto free_mem_out; | 2069 | goto free_mem_out; |
2073 | memset(o_ltp, 0, sizeof(struct ktermios)); | ||
2074 | } | 2070 | } |
2075 | 2071 | ||
2076 | /* | 2072 | /* |
@@ -3755,9 +3751,8 @@ struct tty_driver *alloc_tty_driver(int lines) | |||
3755 | { | 3751 | { |
3756 | struct tty_driver *driver; | 3752 | struct tty_driver *driver; |
3757 | 3753 | ||
3758 | driver = kmalloc(sizeof(struct tty_driver), GFP_KERNEL); | 3754 | driver = kzalloc(sizeof(struct tty_driver), GFP_KERNEL); |
3759 | if (driver) { | 3755 | if (driver) { |
3760 | memset(driver, 0, sizeof(struct tty_driver)); | ||
3761 | driver->magic = TTY_DRIVER_MAGIC; | 3756 | driver->magic = TTY_DRIVER_MAGIC; |
3762 | driver->num = lines; | 3757 | driver->num = lines; |
3763 | /* later we'll move allocation of tables here */ | 3758 | /* later we'll move allocation of tables here */ |