aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/pty.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/tty/pty.c')
-rw-r--r--drivers/tty/pty.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
index 59bfaecc4e14..abfd99089781 100644
--- a/drivers/tty/pty.c
+++ b/drivers/tty/pty.c
@@ -244,14 +244,9 @@ static void pty_flush_buffer(struct tty_struct *tty)
244 244
245static int pty_open(struct tty_struct *tty, struct file *filp) 245static int pty_open(struct tty_struct *tty, struct file *filp)
246{ 246{
247 int retval = -ENODEV;
248
249 if (!tty || !tty->link) 247 if (!tty || !tty->link)
250 goto out; 248 return -ENODEV;
251
252 set_bit(TTY_IO_ERROR, &tty->flags);
253 249
254 retval = -EIO;
255 if (test_bit(TTY_OTHER_CLOSED, &tty->flags)) 250 if (test_bit(TTY_OTHER_CLOSED, &tty->flags))
256 goto out; 251 goto out;
257 if (test_bit(TTY_PTY_LOCK, &tty->link->flags)) 252 if (test_bit(TTY_PTY_LOCK, &tty->link->flags))
@@ -262,9 +257,11 @@ static int pty_open(struct tty_struct *tty, struct file *filp)
262 clear_bit(TTY_IO_ERROR, &tty->flags); 257 clear_bit(TTY_IO_ERROR, &tty->flags);
263 clear_bit(TTY_OTHER_CLOSED, &tty->link->flags); 258 clear_bit(TTY_OTHER_CLOSED, &tty->link->flags);
264 set_bit(TTY_THROTTLED, &tty->flags); 259 set_bit(TTY_THROTTLED, &tty->flags);
265 retval = 0; 260 return 0;
261
266out: 262out:
267 return retval; 263 set_bit(TTY_IO_ERROR, &tty->flags);
264 return -EIO;
268} 265}
269 266
270static void pty_set_termios(struct tty_struct *tty, 267static void pty_set_termios(struct tty_struct *tty,