drivers: modem: gsm: Remove unnecessary mux_enabled check

Remove redundant mux_enabled checks, the code execution will
not reach here if mux_enabled is false in the first place.

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

View file

@ -612,7 +612,7 @@ static void gsm_finalize_connection(struct gsm_modem *gsm)
goto attaching; goto attaching;
} }
if (IS_ENABLED(CONFIG_GSM_MUX) && gsm->mux_enabled) { if (IS_ENABLED(CONFIG_GSM_MUX)) {
ret = modem_cmd_send_nolock(&gsm->context.iface, ret = modem_cmd_send_nolock(&gsm->context.iface,
&gsm->context.cmd_handler, &gsm->context.cmd_handler,
&response_cmds[0], &response_cmds[0],
@ -736,7 +736,7 @@ attaching:
set_ppp_carrier_on(gsm); set_ppp_carrier_on(gsm);
if (IS_ENABLED(CONFIG_GSM_MUX) && gsm->mux_enabled) { if (IS_ENABLED(CONFIG_GSM_MUX)) {
/* Re-use the original iface for AT channel */ /* Re-use the original iface for AT channel */
ret = modem_iface_uart_init_dev(&gsm->context.iface, ret = modem_iface_uart_init_dev(&gsm->context.iface,
gsm->at_dev); gsm->at_dev);
@ -941,7 +941,6 @@ static void mux_setup(struct k_work *work)
gsm->ppp_dev); gsm->ppp_dev);
if (ret < 0) { if (ret < 0) {
LOG_DBG("iface %suart error %d", "PPP ", ret); LOG_DBG("iface %suart error %d", "PPP ", ret);
gsm->mux_enabled = false;
goto fail; goto fail;
} }
@ -990,27 +989,23 @@ static void gsm_configure(struct k_work *work)
gsm->mux_enabled == false) { gsm->mux_enabled == false) {
ret = mux_enable(gsm); ret = mux_enable(gsm);
if (ret == 0) { if (ret) {
LOG_DBG("GSM muxing %s", "enabled");
gsm->mux_enabled = true;
} else {
LOG_DBG("GSM muxing %s", "disabled"); LOG_DBG("GSM muxing %s", "disabled");
(void)gsm_work_reschedule(&gsm->gsm_configure_work, (void)gsm_work_reschedule(&gsm->gsm_configure_work,
K_NO_WAIT); K_NO_WAIT);
return; return;
} }
if (gsm->mux_enabled) { LOG_DBG("GSM muxing %s", "enabled");
gsm->mux_enabled = true;
gsm->state = STATE_INIT; gsm->state = STATE_INIT;
k_work_init_delayable(&gsm->gsm_configure_work, k_work_init_delayable(&gsm->gsm_configure_work, mux_setup);
mux_setup);
(void)gsm_work_reschedule(&gsm->gsm_configure_work, (void)gsm_work_reschedule(&gsm->gsm_configure_work, K_NO_WAIT);
K_NO_WAIT);
return; return;
} }
}
gsm_finalize_connection(gsm); gsm_finalize_connection(gsm);
} }