diff --git a/subsys/modem/modem_cmux.c b/subsys/modem/modem_cmux.c index 843cbf492ee..7f2728958e8 100644 --- a/subsys/modem/modem_cmux.c +++ b/subsys/modem/modem_cmux.c @@ -1015,13 +1015,16 @@ struct modem_pipe_api modem_cmux_dlci_pipe_api = { static void modem_cmux_dlci_open_handler(struct k_work *item) { - struct k_work_delayable *dwork = k_work_delayable_from_work(item); - struct modem_cmux_dlci *dlci = CONTAINER_OF(dwork, struct modem_cmux_dlci, open_work); + struct k_work_delayable *dwork; + struct modem_cmux_dlci *dlci; - if (dlci == NULL) { + if (item == NULL) { return; } + dwork = k_work_delayable_from_work(item); + dlci = CONTAINER_OF(dwork, struct modem_cmux_dlci, open_work); + dlci->state = MODEM_CMUX_DLCI_STATE_OPENING; struct modem_cmux_frame frame = {