From c063c440287b4bd80e66c6595a2610eadbb0a295 Mon Sep 17 00:00:00 2001 From: Yong Cong Sin Date: Thu, 20 Jan 2022 23:30:21 +0800 Subject: [PATCH] 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 --- drivers/modem/gsm_ppp.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/modem/gsm_ppp.c b/drivers/modem/gsm_ppp.c index 3f08f1218c4..9341575414b 100644 --- a/drivers/modem/gsm_ppp.c +++ b/drivers/modem/gsm_ppp.c @@ -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: