Commit 31aeaf54 authored by Karthikeyan Periyasamy's avatar Karthikeyan Periyasamy Committed by Kalle Valo

ath11k: fix DMA memory free in CE pipe cleanup

In CE pipe cleanup, DMA memory gets freed by the aligned address
(base_addr_owner_space) which is wrong. It needs to be freed
by the address (base_addr_owner_space_unaligned) returned by
dma_alloc. So free the dma memory by the proper address.
This was found in code review.

Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.5.0.1-00729-QCAHKSWPL_SILICONZ-3 v2
Signed-off-by: default avatarKarthikeyan Periyasamy <quic_periyasa@quicinc.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/1636561290-18966-1-git-send-email-quic_periyasa@quicinc.com
parent 4c375743
...@@ -953,6 +953,7 @@ int ath11k_ce_init_pipes(struct ath11k_base *ab) ...@@ -953,6 +953,7 @@ int ath11k_ce_init_pipes(struct ath11k_base *ab)
void ath11k_ce_free_pipes(struct ath11k_base *ab) void ath11k_ce_free_pipes(struct ath11k_base *ab)
{ {
struct ath11k_ce_pipe *pipe; struct ath11k_ce_pipe *pipe;
struct ath11k_ce_ring *ce_ring;
int desc_sz; int desc_sz;
int i; int i;
...@@ -964,22 +965,24 @@ void ath11k_ce_free_pipes(struct ath11k_base *ab) ...@@ -964,22 +965,24 @@ void ath11k_ce_free_pipes(struct ath11k_base *ab)
if (pipe->src_ring) { if (pipe->src_ring) {
desc_sz = ath11k_hal_ce_get_desc_size(HAL_CE_DESC_SRC); desc_sz = ath11k_hal_ce_get_desc_size(HAL_CE_DESC_SRC);
ce_ring = pipe->src_ring;
dma_free_coherent(ab->dev, dma_free_coherent(ab->dev,
pipe->src_ring->nentries * desc_sz + pipe->src_ring->nentries * desc_sz +
CE_DESC_RING_ALIGN, CE_DESC_RING_ALIGN,
pipe->src_ring->base_addr_owner_space, ce_ring->base_addr_owner_space_unaligned,
pipe->src_ring->base_addr_ce_space); ce_ring->base_addr_ce_space_unaligned);
kfree(pipe->src_ring); kfree(pipe->src_ring);
pipe->src_ring = NULL; pipe->src_ring = NULL;
} }
if (pipe->dest_ring) { if (pipe->dest_ring) {
desc_sz = ath11k_hal_ce_get_desc_size(HAL_CE_DESC_DST); desc_sz = ath11k_hal_ce_get_desc_size(HAL_CE_DESC_DST);
ce_ring = pipe->dest_ring;
dma_free_coherent(ab->dev, dma_free_coherent(ab->dev,
pipe->dest_ring->nentries * desc_sz + pipe->dest_ring->nentries * desc_sz +
CE_DESC_RING_ALIGN, CE_DESC_RING_ALIGN,
pipe->dest_ring->base_addr_owner_space, ce_ring->base_addr_owner_space_unaligned,
pipe->dest_ring->base_addr_ce_space); ce_ring->base_addr_ce_space_unaligned);
kfree(pipe->dest_ring); kfree(pipe->dest_ring);
pipe->dest_ring = NULL; pipe->dest_ring = NULL;
} }
...@@ -987,11 +990,12 @@ void ath11k_ce_free_pipes(struct ath11k_base *ab) ...@@ -987,11 +990,12 @@ void ath11k_ce_free_pipes(struct ath11k_base *ab)
if (pipe->status_ring) { if (pipe->status_ring) {
desc_sz = desc_sz =
ath11k_hal_ce_get_desc_size(HAL_CE_DESC_DST_STATUS); ath11k_hal_ce_get_desc_size(HAL_CE_DESC_DST_STATUS);
ce_ring = pipe->status_ring;
dma_free_coherent(ab->dev, dma_free_coherent(ab->dev,
pipe->status_ring->nentries * desc_sz + pipe->status_ring->nentries * desc_sz +
CE_DESC_RING_ALIGN, CE_DESC_RING_ALIGN,
pipe->status_ring->base_addr_owner_space, ce_ring->base_addr_owner_space_unaligned,
pipe->status_ring->base_addr_ce_space); ce_ring->base_addr_ce_space_unaligned);
kfree(pipe->status_ring); kfree(pipe->status_ring);
pipe->status_ring = NULL; pipe->status_ring = NULL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment