From c2d4b1cbd971c0672bbf2c99221b70e9e04d6a27 Mon Sep 17 00:00:00 2001 From: Alan Chen Date: Mon, 28 Oct 2019 17:28:35 -0700 Subject: [PATCH] qcacld-3.0: Add sap_pre_cac_work check before flushing In hdd_stop_adapter and hdd_stop_all_adapters, sap_pre_cac_work is sometimes being flushed when it is not initialized. Put a check to only flush if it is initialized. Change-Id: I1e25ae06f351188c1bc45c4f94c80b3c77799b88 CRs-Fixed: 2554551 --- core/hdd/src/wlan_hdd_main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 5900899cde934..03173671a3277 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -5916,7 +5916,8 @@ QDF_STATUS hdd_stop_adapter(struct hdd_context *hdd_ctx, /* don't flush pre-cac destroy if we are destroying pre-cac */ sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(adapter); - if (!wlan_sap_is_pre_cac_context(sap_ctx)) + if (!wlan_sap_is_pre_cac_context(sap_ctx) && + (hdd_ctx->sap_pre_cac_work.fn)) cds_flush_work(&hdd_ctx->sap_pre_cac_work); /* fallthrough */ @@ -6085,7 +6086,8 @@ QDF_STATUS hdd_stop_all_adapters(struct hdd_context *hdd_ctx) hdd_enter(); - cds_flush_work(&hdd_ctx->sap_pre_cac_work); + if (hdd_ctx->sap_pre_cac_work.fn) + cds_flush_work(&hdd_ctx->sap_pre_cac_work); hdd_for_each_adapter(hdd_ctx, adapter) hdd_stop_adapter(hdd_ctx, adapter);