video: tegra: nvmap: Fix kmemleak issues

While unloading the nvmap module, the memory allocated by following
functions should be freed, otherwise it results into kmemleak:
- nvmap_dma_init_coherent_memory
- dev_set_name

Bug 3860404

Change-Id: I7cd187c259ad2ceca0262154c0fb7fe8aedcfac8
Signed-off-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2844474
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Ketan Patil
2023-01-18 10:49:28 +00:00
committed by Laxman Dewangan
parent 76d402ab77
commit afb7cce70c
3 changed files with 22 additions and 11 deletions

View File

@@ -576,7 +576,7 @@ void nvmap_dma_mark_declared_memory_unoccupied(struct device *dev,
spin_unlock_irqrestore(&mem->spinlock, flags);
}
static void nvmap_dma_release_coherent_memory(struct dma_coherent_mem_replica *mem)
void nvmap_dma_release_coherent_memory(struct dma_coherent_mem_replica *mem)
{
if (!mem)
return;
@@ -727,15 +727,9 @@ static int __init nvmap_co_device_init(struct reserved_mem *rmem,
return err;
}
static void nvmap_co_device_release(struct reserved_mem *rmem,struct device *dev)
static void nvmap_co_device_release(struct reserved_mem *rmem, struct device *dev)
{
struct nvmap_platform_carveout *co = rmem->priv;
if (!co)
return;
if (co->usage_mask == NVMAP_HEAP_CARVEOUT_IVM)
kfree(co->name);
return;
}
static const struct reserved_mem_ops nvmap_co_ops = {