Browse Source

qcacmn: restructure function in target_if_free_psoc_tgt_info

Restructure memory free function so both win&mcl can call
it. to avoid memory free mismatch.

Change-Id: I31634f94421f30d74d2eaad44e5df089d489d67f
CRs-Fixed: 3572976
jingxiang ge 1 year ago
parent
commit
6b70bdc5b0
2 changed files with 35 additions and 11 deletions
  1. 12 0
      target_if/core/inc/target_if.h
  2. 23 11
      target_if/core/src/target_if_main.c

+ 12 - 0
target_if/core/inc/target_if.h

@@ -519,6 +519,18 @@ QDF_STATUS target_if_free_pdev_tgt_info(struct wlan_objmgr_pdev *pdev);
  */
 QDF_STATUS target_if_alloc_psoc_tgt_info(struct wlan_objmgr_psoc *psoc);
 
+/**
+ * target_if_psoc_tgt_info_mem_free() - free memory which attached in
+ *                                      psoc tgt info
+ * @tgt_psoc_info: target psoc info object
+ *
+ * API to free allocated memory for target_psoc_info
+ *
+ * Return: SUCCESS on successful memory deallocation or Failure
+ */
+QDF_STATUS target_if_psoc_tgt_info_mem_free(
+		struct target_psoc_info *tgt_psoc_info);
+
 /**
  * target_if_free_psoc_tgt_info() - free psoc tgt info
  * @psoc: pointer to psoc

+ 23 - 11
target_if/core/src/target_if_main.c

@@ -774,30 +774,42 @@ QDF_STATUS target_if_alloc_psoc_tgt_info(struct wlan_objmgr_psoc *psoc)
 	return QDF_STATUS_SUCCESS;
 }
 
-QDF_STATUS target_if_free_psoc_tgt_info(struct wlan_objmgr_psoc *psoc)
+QDF_STATUS target_if_psoc_tgt_info_mem_free(
+		struct target_psoc_info *tgt_psoc_info)
 {
-	struct target_psoc_info *tgt_psoc_info;
 	struct wlan_psoc_host_service_ext_param *ext_param;
 
-	if (!psoc) {
-		target_if_err("psoc is null");
+	if (!tgt_psoc_info) {
+		target_if_err("tgt_psoc_info is NULL");
 		return QDF_STATUS_E_INVAL;
 	}
 
-	tgt_psoc_info = wlan_psoc_get_tgt_if_handle(psoc);
-
+	/* reminder to move this into init_deinit_chainmask_table_free */
 	ext_param = target_psoc_get_service_ext_param(tgt_psoc_info);
-	if (!ext_param) {
-		target_if_err("tgt_psoc_info is NULL");
-		return QDF_STATUS_E_INVAL;
-	}
-	init_deinit_chainmask_table_free(ext_param);
+	if (ext_param)
+		init_deinit_chainmask_table_free(ext_param);
+
 	init_deinit_dbr_ring_cap_free(tgt_psoc_info);
 	init_deinit_spectral_scaling_params_free(tgt_psoc_info);
 	init_deinit_scan_radio_cap_free(tgt_psoc_info);
 	init_deinit_msdu_idx_qtype_map_free(tgt_psoc_info);
 	init_deinit_aux_dev_cap_free(tgt_psoc_info);
 
+	return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS target_if_free_psoc_tgt_info(struct wlan_objmgr_psoc *psoc)
+{
+	struct target_psoc_info *tgt_psoc_info;
+
+	if (!psoc) {
+		target_if_err("psoc is null");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	tgt_psoc_info = wlan_psoc_get_tgt_if_handle(psoc);
+
+	target_if_psoc_tgt_info_mem_free(tgt_psoc_info);
 	qdf_event_destroy(&tgt_psoc_info->info.event);
 
 	wlan_psoc_set_tgt_if_handle(psoc, NULL);