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
This commit is contained in:
Alan Chen 2019-09-11 12:02:50 -07:00 • committed by nshrivas
commit 35cb57c797

View file

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