Forráskód Böngészése

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
Alan Chen 5 éve
szülő
commit
35cb57c797
1 módosított fájl, 9 hozzáadás és 7 törlés
  1. 9 7
      core/hdd/src/wlan_hdd_driver_ops.c

+ 9 - 7
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)