diff options
author | Sathish Ambley <sathishambley@codeaurora.org> | 2015-12-16 10:25:51 -0800 |
---|---|---|
committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-23 21:23:26 -0700 |
commit | ba8056f2a60c085547eb94cb78fdf20458be883c (patch) | |
tree | 781af306fb6861fd43c0ccbca5749a1c1a54e76c /drivers/char/adsprpc.c | |
parent | 0cffc97b53a461c824adbcf95ec99446d552533f (diff) |
msm: ADSPRPC: Call free only when allocation succeed
Call free only when allocation succeeded, otherwise skip freeing
remote heap memory.
Change-Id: I749c7956377764fe04e1b47898b4acb390c6b942
Acked-by: Himateja Reddy <hmreddy@qti.qualcomm.com>
Signed-off-by: Sathish Ambley <sathishambley@codeaurora.org>
Diffstat (limited to 'drivers/char/adsprpc.c')
-rw-r--r-- | drivers/char/adsprpc.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/char/adsprpc.c b/drivers/char/adsprpc.c index 0dfe4fa63646..5ec4d900f95b 100644 --- a/drivers/char/adsprpc.c +++ b/drivers/char/adsprpc.c @@ -417,10 +417,12 @@ static void fastrpc_mmap_free(struct fastrpc_mmap *map) pr_err("failed to free remote heap allocation\n"); return; } - dma_set_attr(DMA_ATTR_SKIP_ZEROING, &attrs); - dma_set_attr(DMA_ATTR_NO_KERNEL_MAPPING, &attrs); - dma_free_attrs(me->adsp_mem_device, map->size, - &(map->va), map->phys, &attrs); + if (map->phys) { + dma_set_attr(DMA_ATTR_SKIP_ZEROING, &attrs); + dma_set_attr(DMA_ATTR_NO_KERNEL_MAPPING, &attrs); + dma_free_attrs(me->adsp_mem_device, map->size, + &(map->va), map->phys, &attrs); + } } else { if (!IS_ERR_OR_NULL(map->handle)) ion_free(fl->apps->client, map->handle); |