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
This commit is contained in:
Alan Chen 2019-10-28 17:28:35 -07:00 committed by nshrivas
parent 902f38ae33
commit c2d4b1cbd9

View File

@ -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);