From 19910666e03888e083244fe04246686d7531409f Mon Sep 17 00:00:00 2001 From: Yong Cong Sin Date: Mon, 3 Jan 2022 23:52:44 +0800 Subject: [PATCH] drivers: modem: gsm: Cancel the work when stopped gsm_ppp_stop should cancel possible running work items. Signed-off-by: Yong Cong Sin Signed-off-by: Wouter Cappelle --- drivers/modem/gsm_ppp.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/modem/gsm_ppp.c b/drivers/modem/gsm_ppp.c index 2c0600b0708..9003f21c2f4 100644 --- a/drivers/modem/gsm_ppp.c +++ b/drivers/modem/gsm_ppp.c @@ -1051,6 +1051,10 @@ void gsm_ppp_stop(const struct device *dev) { struct gsm_modem *gsm = dev->data; struct net_if *iface = gsm->iface; + struct k_work_sync work_sync; + + (void)k_work_cancel_delayable_sync(&gsm->gsm_configure_work, &work_sync); + (void)k_work_cancel_delayable_sync(&gsm->rssi_work_handle, &work_sync); net_if_l2(iface)->enable(iface, false);