summaryrefslogtreecommitdiffstats
path: root/drivers/char/tty_io.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/tty_io.c')
-rw-r--r--drivers/char/tty_io.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index d63578c55..4c6ecae22 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -688,7 +688,6 @@ static int init_dev(kdev_t device, struct tty_struct **ret_tty)
return -ENODEV;
idx = MINOR(device) - driver->minor_start;
- tty = driver->table[idx];
/*
* Check whether we need to acquire the tty semaphore to avoid
@@ -697,7 +696,8 @@ static int init_dev(kdev_t device, struct tty_struct **ret_tty)
down_tty_sem(idx);
/* check whether we're reopening an existing tty */
- if(tty) goto fast_track;
+ tty = driver->table[idx];
+ if (tty) goto fast_track;
/*
* First time open is complex, especially for PTY devices.