Browse Source

qcacmn: Use correct size in consistent free of CE rings

Size in consistent_memory_free should be same as size used in
consistent_memory_alloc. Fix the value sent in consistent free for CE
rings.

Change-Id: Iba6295cead21d357e266e753ca406732021ddfb4
CRs-Fixed: 2165385
Kiran Venkatappa 7 years ago
parent
commit
ae1a370d48
1 changed files with 7 additions and 3 deletions
  1. 7 3
      hif/src/ce/ce_main.c

+ 7 - 3
hif/src/ce/ce_main.c

@@ -1288,6 +1288,7 @@ void ce_fini(struct CE_handle *copyeng)
 	struct CE_state *CE_state = (struct CE_state *)copyeng;
 	unsigned int CE_id = CE_state->id;
 	struct hif_softc *scn = CE_state->scn;
+	uint32_t desc_size;
 
 	CE_state->state = CE_UNUSED;
 	scn->ce_id_to_state[CE_id] = NULL;
@@ -1298,13 +1299,14 @@ void ce_fini(struct CE_handle *copyeng)
 		/* Cleanup the datapath Tx ring */
 		ce_h2t_tx_ce_cleanup(copyeng);
 
+		desc_size = ce_get_desc_size(scn, CE_RING_SRC);
 		if (CE_state->src_ring->shadow_base_unaligned)
 			qdf_mem_free(CE_state->src_ring->shadow_base_unaligned);
 		if (CE_state->src_ring->base_addr_owner_space_unaligned)
 			qdf_mem_free_consistent(scn->qdf_dev,
 						scn->qdf_dev->dev,
 					    (CE_state->src_ring->nentries *
-					     sizeof(struct CE_src_desc) +
+					     desc_size +
 					     CE_DESC_RING_ALIGN),
 					    CE_state->src_ring->
 					    base_addr_owner_space_unaligned,
@@ -1316,11 +1318,12 @@ void ce_fini(struct CE_handle *copyeng)
 		/* Cleanup the datapath Rx ring */
 		ce_t2h_msg_ce_cleanup(copyeng);
 
+		desc_size = ce_get_desc_size(scn, CE_RING_DEST);
 		if (CE_state->dest_ring->base_addr_owner_space_unaligned)
 			qdf_mem_free_consistent(scn->qdf_dev,
 						scn->qdf_dev->dev,
 					    (CE_state->dest_ring->nentries *
-					     sizeof(struct CE_dest_desc) +
+					     desc_size +
 					     CE_DESC_RING_ALIGN),
 					    CE_state->dest_ring->
 					    base_addr_owner_space_unaligned,
@@ -1342,11 +1345,12 @@ void ce_fini(struct CE_handle *copyeng)
 			qdf_mem_free(
 				CE_state->status_ring->shadow_base_unaligned);
 
+		desc_size = ce_get_desc_size(scn, CE_RING_STATUS);
 		if (CE_state->status_ring->base_addr_owner_space_unaligned)
 			qdf_mem_free_consistent(scn->qdf_dev,
 						scn->qdf_dev->dev,
 					    (CE_state->status_ring->nentries *
-					     sizeof(struct CE_src_desc) +
+					     desc_size +
 					     CE_DESC_RING_ALIGN),
 					    CE_state->status_ring->
 					    base_addr_owner_space_unaligned,