aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/char/tty_io.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index 7a32df594907..389da364e6b6 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -3720,11 +3720,10 @@ int tty_register_driver(struct tty_driver *driver)
3720 if (driver->flags & TTY_DRIVER_INSTALLED) 3720 if (driver->flags & TTY_DRIVER_INSTALLED)
3721 return 0; 3721 return 0;
3722 3722
3723 if (!(driver->flags & TTY_DRIVER_DEVPTS_MEM)) { 3723 if (!(driver->flags & TTY_DRIVER_DEVPTS_MEM) && driver->num) {
3724 p = kmalloc(driver->num * 3 * sizeof(void *), GFP_KERNEL); 3724 p = kzalloc(driver->num * 3 * sizeof(void *), GFP_KERNEL);
3725 if (!p) 3725 if (!p)
3726 return -ENOMEM; 3726 return -ENOMEM;
3727 memset(p, 0, driver->num * 3 * sizeof(void *));
3728 } 3727 }
3729 3728
3730 if (!driver->major) { 3729 if (!driver->major) {