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