qcacld-3.0: Check the validity of CDS context before disable WDI path

While WLAN module closed, there is a race condition and CDS scheduler
could not be closed before CDS context closure.
This could cause a crash by acessing NULL cds context while the last
WLAN_CLIENT_DISCONNECT event processing.
Fix to check the CDS context before processing the last disconenct
event.

Change-Id: I9aba4659ec6ea682697f342d9c92e09d8f2f90e8
CRs-Fixed: 1096347
diff --git a/core/hdd/src/wlan_hdd_ipa.c b/core/hdd/src/wlan_hdd_ipa.c
index 5ac58a6..481aeb0 100644
--- a/core/hdd/src/wlan_hdd_ipa.c
+++ b/core/hdd/src/wlan_hdd_ipa.c
@@ -1299,6 +1299,12 @@
 	p_cds_contextType cds_ctx = hdd_ipa->hdd_ctx->pcds_context;
 	void *soc = cds_get_context(QDF_MODULE_ID_SOC);
 
+	if (!cds_ctx || !cds_ctx->pdev_txrx_ctx) {
+		HDD_IPA_LOG(QDF_TRACE_LEVEL_ERROR, "txrx context is NULL");
+		QDF_ASSERT(0);
+		return;
+	}
+
 	hdd_ipa->resource_unloading = true;
 	HDD_IPA_LOG(QDF_TRACE_LEVEL_INFO, "%s: Disable FW RX PIPE", __func__);
 	cdp_ipa_set_active(soc, cds_ctx->pdev_txrx_ctx, false, false);
@@ -4152,9 +4158,11 @@
 	if (hdd_ipa_uc_is_enabled(hdd_ipa->hdd_ctx)) {
 		if (hdd_ipa->resource_loading) {
 			unsigned int pending_event_count;
-
 			struct ipa_uc_pending_event *pending_event = NULL;
 
+			HDD_IPA_LOG(QDF_TRACE_LEVEL_ERROR, "IPA resource %s inprogress",
+					hdd_ipa->resource_loading ? "load":"unload");
+
 			hdd_err("IPA resource %s inprogress",
 					hdd_ipa->resource_loading ? "load":"unload");
 
@@ -4172,7 +4180,8 @@
 			}
 
 			if (!pending_event) {
-				hdd_err("Pending event memory alloc fail");
+				HDD_IPA_LOG(QDF_TRACE_LEVEL_ERROR,
+				    "Pending event memory alloc fail");
 				qdf_mutex_release(&hdd_ipa->event_lock);
 				return -ENOMEM;
 			}