]> git.karo-electronics.de Git - linux-beck.git/commitdiff
tty/n_gsm.c: get gsm->num after gsm_activate_mux
authorxinhui.pan <xinhuix.pan@intel.com>
Wed, 23 Jul 2014 06:31:09 +0000 (14:31 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 24 Jul 2014 01:56:17 +0000 (18:56 -0700)
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>
drivers/tty/n_gsm.c

index 2ebe47b78a3e3ba48093d46164bee6247a32295e..81e7ccbd9e4af571cc1f87a0a070d018b2dc631a 100644 (file)
@@ -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)
 {
-       int ret, i;
-       int base = gsm->num << 6; /* Base for this MUX */
+       int ret, i, base;
 
        gsm->tty = tty_kref_get(tty);
        gsm->output = gsmld_output;
@@ -2241,6 +2240,7 @@ static int gsmld_attach_gsm(struct tty_struct *tty, struct gsm_mux *gsm)
        else {
                /* Don't register device 0 - this is the control channel and not
                   a usable tty interface */
+               base = gsm->num << 6; /* Base for this MUX */
                for (i = 1; i < NUM_DLCI; i++)
                        tty_register_device(gsm_tty_driver, base + i, NULL);
        }