aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty
diff options
context:
space:
mode:
authorxinhui.pan <xinhuix.pan@intel.com>2014-07-23 02:31:09 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-07-23 21:56:17 -0400
commit850e93eb299dfe9379609d5755068d47b03954f8 (patch)
treee60431dfd9e68d893e1a64d0decb5dbcecb0ab1f /drivers/tty
parentc2b703b807e3aba4d2b542c9096c790186a6e71f (diff)
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: xinhui.pan <xinhuiX.pan@intel.com> Acked-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/n_gsm.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
index 2ebe47b78a3e..81e7ccbd9e4a 100644
--- a/drivers/tty/n_gsm.c
+++ b/drivers/tty/n_gsm.c
@@ -2230,8 +2230,7 @@ static int gsmld_output(struct gsm_mux *gsm, u8 *data, int len)
2230 2230
2231static int gsmld_attach_gsm(struct tty_struct *tty, struct gsm_mux *gsm) 2231static int gsmld_attach_gsm(struct tty_struct *tty, struct gsm_mux *gsm)
2232{ 2232{
2233 int ret, i; 2233 int ret, i, base;
2234 int base = gsm->num << 6; /* Base for this MUX */
2235 2234
2236 gsm->tty = tty_kref_get(tty); 2235 gsm->tty = tty_kref_get(tty);
2237 gsm->output = gsmld_output; 2236 gsm->output = gsmld_output;
@@ -2241,6 +2240,7 @@ static int gsmld_attach_gsm(struct tty_struct *tty, struct gsm_mux *gsm)
2241 else { 2240 else {
2242 /* Don't register device 0 - this is the control channel and not 2241 /* Don't register device 0 - this is the control channel and not
2243 a usable tty interface */ 2242 a usable tty interface */
2243 base = gsm->num << 6; /* Base for this MUX */
2244 for (i = 1; i < NUM_DLCI; i++) 2244 for (i = 1; i < NUM_DLCI; i++)
2245 tty_register_device(gsm_tty_driver, base + i, NULL); 2245 tty_register_device(gsm_tty_driver, base + i, NULL);
2246 } 2246 }