]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - drivers/char/tty_io.c
tty_io: Use kzalloc
[mirror_ubuntu-artful-kernel.git] / drivers / char / tty_io.c
index a37e6330db8acf2682c834dad7744ced495a0d39..fde69e589ca74e25bf891365a683edcc6dd98f3d 100644 (file)
@@ -2033,11 +2033,9 @@ static int init_dev(struct tty_driver *driver, int idx,
        }
 
        if (!*ltp_loc) {
-               ltp = (struct ktermios *) kmalloc(sizeof(struct ktermios),
-                                                GFP_KERNEL);
+               ltp = kzalloc(sizeof(struct ktermios), GFP_KERNEL);
                if (!ltp)
                        goto free_mem_out;
-               memset(ltp, 0, sizeof(struct ktermios));
        }
 
        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) {
-                       o_ltp = (struct ktermios *)
-                               kmalloc(sizeof(struct ktermios), GFP_KERNEL);
+                       o_ltp = kzalloc(sizeof(struct ktermios), GFP_KERNEL);
                        if (!o_ltp)
                                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;
 
-       driver = kmalloc(sizeof(struct tty_driver), GFP_KERNEL);
+       driver = kzalloc(sizeof(struct tty_driver), GFP_KERNEL);
        if (driver) {
-               memset(driver, 0, sizeof(struct tty_driver));
                driver->magic = TTY_DRIVER_MAGIC;
                driver->num = lines;
                /* later we'll move allocation of tables here */