From 5f6db4bacd99a7af1583ae839b68f1e301ea9db5 Mon Sep 17 00:00:00 2001 From: Jeya R Date: Wed, 12 May 2021 13:34:34 +0530 Subject: [PATCH] adsprpc: Do not free if flag is set to persistent Do not free the dma memory for remote heap flag if the persistent attribute is set to true. Change-Id: I2ca25e347c6a4250b64c436a1f606cd541f17554 Signed-off-by: Jeya R --- drivers/char/adsprpc.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/char/adsprpc.c b/drivers/char/adsprpc.c index 051b43934810..939c27c92079 100644 --- a/drivers/char/adsprpc.c +++ b/drivers/char/adsprpc.c @@ -975,7 +975,7 @@ static int fastrpc_minidump_remove_region(struct fastrpc_mmap *map) map->frpc_md_index = -1; } } else { - ADSPRPC_ERR("mini-dump enabled with invalid unique id: %d\n", map->frpc_md_index); + ADSPRPC_WARN("mini-dump enabled with invalid unique id: %d\n", map->frpc_md_index); } return err; } @@ -1275,11 +1275,11 @@ static void fastrpc_mmap_free(struct fastrpc_mmap *map, uint32_t flags) return; } - if (msm_minidump_enabled()) { + if (msm_minidump_enabled() && !map->is_persistent) err = fastrpc_minidump_remove_region(map); - } - trace_fastrpc_dma_free(-1, map->phys, map->size); - if (map->phys) { + + if (map->phys && !map->is_persistent) { + trace_fastrpc_dma_free(-1, map->phys, map->size); dma_free_attrs(me->dev, map->size, (void *)map->va, (dma_addr_t)map->phys, (unsigned long)map->attr); } @@ -1324,7 +1324,9 @@ static void fastrpc_mmap_free(struct fastrpc_mmap *map, uint32_t flags) if (!IS_ERR_OR_NULL(map->buf)) dma_buf_put(map->buf); } - kfree(map); + if (!map->is_persistent) { + kfree(map); + } } static int fastrpc_session_alloc(struct fastrpc_channel_ctx *chan, int secure,