From 35cb57c797520f2287a8b58edc3dc4e4b89e3205 Mon Sep 17 00:00:00 2001 From: Alan Chen Date: Wed, 11 Sep 2019 12:02:50 -0700 Subject: [PATCH] qcacld-3.0: Perform timing profiling after validating hdd_ctx Pointer hdd_ctx returned from the call to function cds_get_context may be NULL and will be dereferenced. Move the recording of timing of runtime PM operations to after validation of hdd_ctx. Change-Id: I5da02c3fdb695be25bf0b59f4fe33e599e751d03 CRs-Fixed: 2524971 --- core/hdd/src/wlan_hdd_driver_ops.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/core/hdd/src/wlan_hdd_driver_ops.c b/core/hdd/src/wlan_hdd_driver_ops.c index ade1843120a8..3d023912c1fe 100644 --- a/core/hdd/src/wlan_hdd_driver_ops.c +++ b/core/hdd/src/wlan_hdd_driver_ops.c @@ -1395,18 +1395,13 @@ static int hdd_pld_runtime_resume_cb(void) */ static int wlan_hdd_runtime_resume(struct device *dev) { - struct hdd_context *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); + struct hdd_context *hdd_ctx; QDF_STATUS status; qdf_time_t delta; hdd_debug("Starting runtime resume"); - hdd_ctx->runtime_resume_start_time_stamp = - qdf_get_log_timestamp_usecs(); - delta = hdd_ctx->runtime_resume_start_time_stamp - - hdd_ctx->runtime_suspend_done_time_stamp; - hdd_debug("Starting runtime resume total cxpc down time %lu microseconds", - delta); + hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); if (wlan_hdd_validate_context(hdd_ctx)) return 0; @@ -1415,6 +1410,13 @@ static int wlan_hdd_runtime_resume(struct device *dev) return 0; } + hdd_ctx->runtime_resume_start_time_stamp = + qdf_get_log_timestamp_usecs(); + delta = hdd_ctx->runtime_resume_start_time_stamp - + hdd_ctx->runtime_suspend_done_time_stamp; + hdd_debug("Starting runtime resume total cxpc down time %lu microseconds", + delta); + status = ucfg_pmo_psoc_bus_runtime_resume(hdd_ctx->psoc, hdd_pld_runtime_resume_cb); if (status != QDF_STATUS_SUCCESS)