From ffd584f1c2728482a867e7b1687fbf3538629e06 Mon Sep 17 00:00:00 2001 From: Dustin Brown Date: Mon, 20 Aug 2018 13:03:33 -0700 Subject: [PATCH] qcacld-3.0: Check recovery enabled before unloading In cds_trigger_recovery(), we avoid recovery if the wlan driver is unloading. While this is ideal for production devices, we would like to panic in debug builds for offline analysis. Move the check to see if the wlan driver is unloading to immediately after the check to see if we should panic or not. Change-Id: I07cc624295416ca555eb4d847f709cf30e6672bb CRs-Fixed: 2299903 --- core/cds/src/cds_api.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/core/cds/src/cds_api.c b/core/cds/src/cds_api.c index 4b1621d46b15..d923ddc8c23a 100644 --- a/core/cds/src/cds_api.c +++ b/core/cds/src/cds_api.c @@ -1794,32 +1794,39 @@ static void cds_trigger_recovery_handler(const char *func, const uint32_t line) qdf_runtime_lock_t rtl; qdf_device_t qdf; - if (cds_is_driver_unloading()) { - cds_err("Unloading in progress; ignoring recovery trigger"); - return; - } + /* NOTE! This code path is delicate! Think very carefully before + * modifying the content or order of the following. Please review any + * potential changes with someone closely familiar with this feature. + */ if (cds_is_driver_recovering()) { - cds_err("Recovery in progress; ignoring recovery trigger"); + cds_info("WLAN recovery already in progress"); return; } if (cds_is_driver_in_bad_state()) { - cds_err("Driver is in bad state; ignoring recovery trigger"); + cds_info("WLAN has already failed recovery"); return; } if (cds_is_fw_down()) { - cds_err("FW is down; ignoring recovery trigger"); + cds_info("Firmware has already initiated recovery"); return; } + /* if *wlan* recovery is disabled, crash here for debugging */ if (!cds_is_self_recovery_enabled()) { - QDF_DEBUG_PANIC("Recovery is not enabled (via %s:%d)", + QDF_DEBUG_PANIC("WLAN recovery is not enabled (via %s:%d)", func, line); return; } + /* ignore recovery if we are unloading; it would be a waste anyway */ + if (cds_is_driver_unloading()) { + cds_info("WLAN is unloading; ignore recovery"); + return; + } + qdf = cds_get_context(QDF_MODULE_ID_QDF_DEVICE); if (!qdf) { cds_err("Qdf context is null"); @@ -2479,6 +2486,7 @@ void cds_init_ini_config(struct cds_config_info *cfg) void cds_deinit_ini_config(void) { struct cds_context *cds_ctx; + struct cds_config_info *cds_cfg; cds_ctx = cds_get_context(QDF_MODULE_ID_QDF); if (!cds_ctx) { @@ -2486,10 +2494,11 @@ void cds_deinit_ini_config(void) return; } - if (cds_ctx->cds_cfg) - qdf_mem_free(cds_ctx->cds_cfg); - + cds_cfg = cds_ctx->cds_cfg; cds_ctx->cds_cfg = NULL; + + if (cds_cfg) + qdf_mem_free(cds_cfg); } /**