summaryrefslogtreecommitdiff
path: root/drivers/char/pty.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/pty.c')
-rw-r--r--drivers/char/pty.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/char/pty.c b/drivers/char/pty.c
index 4e6490bda751..c98450023030 100644
--- a/drivers/char/pty.c
+++ b/drivers/char/pty.c
@@ -501,11 +501,13 @@ static int __ptmx_open(struct inode *inode, struct file *filp)
return index;
mutex_lock(&tty_mutex);
- retval = tty_init_dev(ptm_driver, index, &tty, 1);
+ tty = tty_init_dev(ptm_driver, index, 1);
mutex_unlock(&tty_mutex);
- if (retval)
+ if (IS_ERR(tty)) {
+ retval = PTR_ERR(tty);
goto out;
+ }
set_bit(TTY_PTY_LOCK, &tty->flags); /* LOCK THE SLAVE */
filp->private_data = tty;