diff options
author | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2016-05-02 13:49:28 +0200 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2016-05-04 16:29:51 +0200 |
commit | b512353c15fe7665893e92e0c989c088505a37b8 (patch) | |
tree | df61ae58591dfa47a96a2fd2966caa0f7a1e6da4 /drivers/s390 | |
parent | s390/3270: add missing tty_kref_put (diff) | |
download | linux-b512353c15fe7665893e92e0c989c088505a37b8.tar.xz linux-b512353c15fe7665893e92e0c989c088505a37b8.zip |
s390/3270: fix view reference counting
The tty3270_close function set tty->driver_data to NULL after the
open count dropped to zero but tty3270_cleanup still needs the
pointer to the tty3270 view to drop the reference count.
Move the clearing of tty->driver_data to tty3270_cleanup and
drop the unnecessary tty_port_tty_set calls in tty3270_install.
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390')
-rw-r--r-- | drivers/s390/char/tty3270.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/s390/char/tty3270.c b/drivers/s390/char/tty3270.c index 345f392b50b2..e8afa07f082e 100644 --- a/drivers/s390/char/tty3270.c +++ b/drivers/s390/char/tty3270.c @@ -924,10 +924,8 @@ static int tty3270_install(struct tty_driver *driver, struct tty_struct *tty) tty->winsize.ws_row = tp->view.rows - 2; tty->winsize.ws_col = tp->view.cols; tp->port.low_latency = 0; - /* why to reassign? */ - tty_port_tty_set(&tp->port, tty); tp->inattr = TF_INPUT; - return tty_port_install(&tp->port, driver, tty); + goto port_install; } if (tty3270_max_index < tty->index + 1) tty3270_max_index = tty->index + 1; @@ -953,7 +951,6 @@ static int tty3270_install(struct tty_driver *driver, struct tty_struct *tty) return rc; } - tty_port_tty_set(&tp->port, tty); tp->port.low_latency = 0; tty->winsize.ws_row = tp->view.rows - 2; tty->winsize.ws_col = tp->view.cols; @@ -975,6 +972,7 @@ static int tty3270_install(struct tty_driver *driver, struct tty_struct *tty) raw3270_activate_view(&tp->view); +port_install: rc = tty_port_install(&tp->port, driver, tty); if (rc) { raw3270_put_view(&tp->view); @@ -1011,18 +1009,18 @@ tty3270_close(struct tty_struct *tty, struct file * filp) if (tty->count > 1) return; - if (tp) { - tty->driver_data = NULL; + if (tp) tty_port_tty_set(&tp->port, NULL); - } } static void tty3270_cleanup(struct tty_struct *tty) { struct tty3270 *tp = tty->driver_data; - if (tp) + if (tp) { + tty->driver_data = NULL; raw3270_put_view(&tp->view); + } } /* |