hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/tty/n_gsm.c
....@@ -50,6 +50,7 @@
5050 #include <linux/netdevice.h>
5151 #include <linux/etherdevice.h>
5252 #include <linux/gsmmux.h>
53
+#include "tty.h"
5354
5455 static int debug;
5556 module_param(debug, int, 0600);
....@@ -2158,12 +2159,13 @@
21582159 static void gsm_cleanup_mux(struct gsm_mux *gsm, bool disc)
21592160 {
21602161 int i;
2161
- struct gsm_dlci *dlci = gsm->dlci[0];
2162
+ struct gsm_dlci *dlci;
21622163 struct gsm_msg *txq, *ntxq;
21632164
21642165 gsm->dead = true;
21652166 mutex_lock(&gsm->mutex);
21662167
2168
+ dlci = gsm->dlci[0];
21672169 if (dlci) {
21682170 if (disc && dlci->state != DLCI_CLOSED) {
21692171 gsm_dlci_begin_close(dlci);
....@@ -2177,8 +2179,10 @@
21772179
21782180 /* Free up any link layer users and finally the control channel */
21792181 for (i = NUM_DLCI - 1; i >= 0; i--)
2180
- if (gsm->dlci[i])
2182
+ if (gsm->dlci[i]) {
21812183 gsm_dlci_release(gsm->dlci[i]);
2184
+ gsm->dlci[i] = NULL;
2185
+ }
21822186 mutex_unlock(&gsm->mutex);
21832187 /* Now wipe the queues */
21842188 tty_ldisc_flush(gsm->tty);