misc: easelcomm: Fix memory leak in easelcomm scatterlist

1. easelcomm_hw_build_scatterlist() allocates the sglocaldata, but
   it was not freed in easelcomm_hw_destroy_scatterlist().
2. Added kfree to prevent memory leak of "struct sg_local_data"
3. It leaked 13 KB on both AP and easel kernel memory per shot. (128
   bytes per dma transfer, 103 occurrence per shot in burst_process.)

Bug: 79539939
Change-Id: I71b49a362b1c4c2108979286efb600c4a8ff667a
Signed-off-by: Richard Hsu <hsuy@google.com>
This commit is contained in:
Richard Hsu
2018-05-10 16:50:39 -07:00
parent c751d29bb6
commit 67daddd118
2 changed files with 13 additions and 2 deletions

View File

@@ -534,6 +534,7 @@ void easelcomm_hw_destroy_scatterlist(void *sglocaldata)
/* Release sgl retrieved from dma_buf framework */
mnh_sg_release_from_dma_buf(sg_local_data);
}
kfree(sg_local_data);
}
}
EXPORT_SYMBOL(easelcomm_hw_destroy_scatterlist);

View File

@@ -44,11 +44,21 @@ enum easelcomm_msg_type {
* transfer have default values for these.
*/
struct easelcomm_dma_xfer_info {
/* The local MNH driver scatter-gather list, or NULL if discarding */
/*
* The local MNH driver scatter-gather list, or NULL if discarding.
* This points to an array of mnh_sg_entry. Content of this is
* to be used to combine with remote scatter-gather list to be a
* DMA Linked List.
*/
void *sg_local;
/* Size in bytes of the local scatter-gather list, zero if discard */
uint32_t sg_local_size;
/* Local data private to the MNH layer associated with the SG list */
/*
* Local data private to the MNH layer associated with the SG list.
* This points to mnh_sg_list. It marks information of
* the buffer for DMA transfer, and is used to collect local MNH
* driver scatter-gather list (sg_local).
*/
void *sg_local_localdata;
/*
* Easel/server keeps the remote scatter-gather list received from the