drivers: modem: gsm: Go to next state if mux_attach successfully

Currently the mux_setup set the state to the next one after
uart_mux_alloc is successful even if the mux_setup fails which
can be a problem.

Set the state after both mux_setup & uart_mux_alloc are
successful.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
This commit is contained in:
Yong Cong Sin 2022-01-20 23:30:21 +08:00 committed by Carles Cufí
commit c063c44028

View file

@ -883,13 +883,13 @@ static void mux_setup(struct k_work *work)
}
}
gsm->state = STATE_PPP_CHANNEL;
ret = mux_attach(gsm->control_dev, uart, DLCI_CONTROL, gsm);
if (ret < 0) {
goto fail;
}
gsm->state = STATE_PPP_CHANNEL;
break;
case STATE_PPP_CHANNEL:
@ -902,13 +902,13 @@ static void mux_setup(struct k_work *work)
}
}
gsm->state = STATE_AT_CHANNEL;
ret = mux_attach(gsm->ppp_dev, uart, DLCI_PPP, gsm);
if (ret < 0) {
goto fail;
}
gsm->state = STATE_AT_CHANNEL;
break;
case STATE_AT_CHANNEL:
@ -921,13 +921,13 @@ static void mux_setup(struct k_work *work)
}
}
gsm->state = STATE_DONE;
ret = mux_attach(gsm->at_dev, uart, DLCI_AT, gsm);
if (ret < 0) {
goto fail;
}
gsm->state = STATE_DONE;
break;
case STATE_DONE: