Commit 850e93eb authored by xinhui.pan's avatar xinhui.pan Committed by Greg Kroah-Hartman

tty/n_gsm.c: get gsm->num after gsm_activate_mux

gsm->num is the index of gsm_mux[], it's invalid before calling gsm_activate_mux.
Signed-off-by: default avatarxinhui.pan <xinhuiX.pan@intel.com>
Acked-by: default avatarAlan Cox <alan@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c2b703b8
...@@ -2230,8 +2230,7 @@ static int gsmld_output(struct gsm_mux *gsm, u8 *data, int len) ...@@ -2230,8 +2230,7 @@ static int gsmld_output(struct gsm_mux *gsm, u8 *data, int len)
static int gsmld_attach_gsm(struct tty_struct *tty, struct gsm_mux *gsm) static int gsmld_attach_gsm(struct tty_struct *tty, struct gsm_mux *gsm)
{ {
int ret, i; int ret, i, base;
int base = gsm->num << 6; /* Base for this MUX */
gsm->tty = tty_kref_get(tty); gsm->tty = tty_kref_get(tty);
gsm->output = gsmld_output; gsm->output = gsmld_output;
...@@ -2241,6 +2240,7 @@ static int gsmld_attach_gsm(struct tty_struct *tty, struct gsm_mux *gsm) ...@@ -2241,6 +2240,7 @@ static int gsmld_attach_gsm(struct tty_struct *tty, struct gsm_mux *gsm)
else { else {
/* Don't register device 0 - this is the control channel and not /* Don't register device 0 - this is the control channel and not
a usable tty interface */ a usable tty interface */
base = gsm->num << 6; /* Base for this MUX */
for (i = 1; i < NUM_DLCI; i++) for (i = 1; i < NUM_DLCI; i++)
tty_register_device(gsm_tty_driver, base + i, NULL); tty_register_device(gsm_tty_driver, base + i, NULL);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment