From a64b512a9e4e07aa8ee34e934de1cd295e0fa6cc Mon Sep 17 00:00:00 2001 From: Sanjay Devnani Date: Mon, 23 Nov 2015 11:42:35 -0800 Subject: [PATCH] qcacld-3.0: Check if unload is in progress during suspend If unload in progress, abort suspend. causes null pointer ref otherwise Change-Id: I7028b6f0efc9da62352b561e9def90ff9bffd5e6 CRs-Fixed: 878755 --- core/cds/inc/cds_api.h | 2 ++ core/cds/src/cds_api.c | 25 +++++++++++++++++++++++++ core/hif/src/ce/ce_main.c | 3 +++ 3 files changed, 30 insertions(+) diff --git a/core/cds/inc/cds_api.h b/core/cds/inc/cds_api.h index c88068f0e61f..cb30c6eb0e2b 100644 --- a/core/cds/inc/cds_api.h +++ b/core/cds/inc/cds_api.h @@ -81,6 +81,8 @@ uint8_t cds_is_logp_in_progress(void); void cds_set_logp_in_progress(uint8_t value); uint8_t cds_is_load_unload_in_progress(void); +uint8_t cds_is_unload_in_progress(void); + void cds_set_load_unload_in_progress(uint8_t value); CDF_STATUS cds_alloc_context(void *p_cds_context, CDF_MODULE_ID moduleID, diff --git a/core/cds/src/cds_api.c b/core/cds/src/cds_api.c index 6a3d0391ea6f..188bd2a04701 100644 --- a/core/cds/src/cds_api.c +++ b/core/cds/src/cds_api.c @@ -1089,6 +1089,31 @@ uint8_t cds_is_load_unload_in_progress(void) return gp_cds_context->isLoadUnloadInProgress; } +/** + * cds_is_unload_in_progress() - check if driver unload in + * progress + * + * Return: true if unload is going on else false + */ +uint8_t cds_is_unload_in_progress(void) +{ + hdd_context_t *hdd_ctx = NULL; + if (gp_cds_context == NULL) { + CDF_TRACE(CDF_MODULE_ID_CDF, CDF_TRACE_LEVEL_ERROR, + "%s: global cds context is NULL", __func__); + return 0; + } + hdd_ctx = cds_get_context(CDF_MODULE_ID_HDD); + + if (hdd_ctx == NULL) { + CDF_TRACE(CDF_MODULE_ID_CDF, CDF_TRACE_LEVEL_ERROR, + "%s: HDD context is NULL", __func__); + return 0; + } + + return hdd_ctx->isUnloadInProgress; +} + /** * cds_set_load_unload_in_progress() - set load/unload in progress * @value: value to set diff --git a/core/hif/src/ce/ce_main.c b/core/hif/src/ce/ce_main.c index 68ce9345f6b6..db5884017770 100644 --- a/core/hif/src/ce/ce_main.c +++ b/core/hif/src/ce/ce_main.c @@ -1772,6 +1772,9 @@ static void hif_sleep_entry(void *arg) if (scn->recovery) return; + if (cds_is_unload_in_progress()) + return; + cdf_spin_lock_irqsave(&hif_state->keep_awake_lock); if (hif_state->verified_awake == false) { idle_ms = cdf_system_ticks_to_msecs(cdf_system_ticks()