diff options
author | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2016-05-02 07:49:28 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2016-05-04 10:29:51 -0400 |
commit | b512353c15fe7665893e92e0c989c088505a37b8 (patch) | |
tree | df61ae58591dfa47a96a2fd2966caa0f7a1e6da4 | |
parent | 5ff04fe5659f78c0450cc6858b12bba9e4049578 (diff) |
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>
-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) | |||
924 | tty->winsize.ws_row = tp->view.rows - 2; | 924 | tty->winsize.ws_row = tp->view.rows - 2; |
925 | tty->winsize.ws_col = tp->view.cols; | 925 | tty->winsize.ws_col = tp->view.cols; |
926 | tp->port.low_latency = 0; | 926 | tp->port.low_latency = 0; |
927 | /* why to reassign? */ | ||
928 | tty_port_tty_set(&tp->port, tty); | ||
929 | tp->inattr = TF_INPUT; | 927 | tp->inattr = TF_INPUT; |
930 | return tty_port_install(&tp->port, driver, tty); | 928 | goto port_install; |
931 | } | 929 | } |
932 | if (tty3270_max_index < tty->index + 1) | 930 | if (tty3270_max_index < tty->index + 1) |
933 | tty3270_max_index = tty->index + 1; | 931 | tty3270_max_index = tty->index + 1; |
@@ -953,7 +951,6 @@ static int tty3270_install(struct tty_driver *driver, struct tty_struct *tty) | |||
953 | return rc; | 951 | return rc; |
954 | } | 952 | } |
955 | 953 | ||
956 | tty_port_tty_set(&tp->port, tty); | ||
957 | tp->port.low_latency = 0; | 954 | tp->port.low_latency = 0; |
958 | tty->winsize.ws_row = tp->view.rows - 2; | 955 | tty->winsize.ws_row = tp->view.rows - 2; |
959 | tty->winsize.ws_col = tp->view.cols; | 956 | tty->winsize.ws_col = tp->view.cols; |
@@ -975,6 +972,7 @@ static int tty3270_install(struct tty_driver *driver, struct tty_struct *tty) | |||
975 | 972 | ||
976 | raw3270_activate_view(&tp->view); | 973 | raw3270_activate_view(&tp->view); |
977 | 974 | ||
975 | port_install: | ||
978 | rc = tty_port_install(&tp->port, driver, tty); | 976 | rc = tty_port_install(&tp->port, driver, tty); |
979 | if (rc) { | 977 | if (rc) { |
980 | raw3270_put_view(&tp->view); | 978 | raw3270_put_view(&tp->view); |
@@ -1011,18 +1009,18 @@ tty3270_close(struct tty_struct *tty, struct file * filp) | |||
1011 | 1009 | ||
1012 | if (tty->count > 1) | 1010 | if (tty->count > 1) |
1013 | return; | 1011 | return; |
1014 | if (tp) { | 1012 | if (tp) |
1015 | tty->driver_data = NULL; | ||
1016 | tty_port_tty_set(&tp->port, NULL); | 1013 | tty_port_tty_set(&tp->port, NULL); |
1017 | } | ||
1018 | } | 1014 | } |
1019 | 1015 | ||
1020 | static void tty3270_cleanup(struct tty_struct *tty) | 1016 | static void tty3270_cleanup(struct tty_struct *tty) |
1021 | { | 1017 | { |
1022 | struct tty3270 *tp = tty->driver_data; | 1018 | struct tty3270 *tp = tty->driver_data; |
1023 | 1019 | ||
1024 | if (tp) | 1020 | if (tp) { |
1021 | tty->driver_data = NULL; | ||
1025 | raw3270_put_view(&tp->view); | 1022 | raw3270_put_view(&tp->view); |
1023 | } | ||
1026 | } | 1024 | } |
1027 | 1025 | ||
1028 | /* | 1026 | /* |