Skip to contentSkip to conversation

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

PATCH In review xinhui.pan 2 participants 2 messages Jul 23, 2014 TTY layer and serial drivers

lore
Share & tools
lore

xinhui.pan

author
#0 lore raw

PATCH 1/1 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.

---
 drivers/tty/n_gsm.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/tty/n_gsm.c +2 -2
index 2ebe47b..81e7ccb 100644
@@ -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);
 	}
Signature · 1 line
1.7.9.5