summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhijun He <zhhe@nvidia.com>2010-10-11 21:04:34 -0700
committerVarun Colbert <vcolbert@nvidia.com>2010-10-13 14:56:52 -0700
commit0120a5b05699269c4ce6669ea1aa37b8ed2ed0f9 (patch)
tree282c9faaad4e9d53aaab92c3f35e0ca5924f221b
parent13bf45b3c548319aa411541c760516ffe1b5eaff (diff)
[ARM/Tegra] nvmap: fix a crash in _nvmap_handle_free
When the memory for a handle is not allocated, and then if the caller calls _nvmap_handle_free it should not do the cache operations on the memory as there is no memory allocated Bug 731923 Reviewed-on: http://git-master.nvidia.com/r/7166 (cherry picked from commit f3824fd58e2654a0d8d3159cb1f776d3ad0169a2) Change-Id: Icf11ece6d07e122991e0d9b6b4a3dbf8c45ea017 Reviewed-on: http://git-master.nvidia.com/r/8265 Reviewed-by: Varun Colbert <vcolbert@nvidia.com> Tested-by: Varun Colbert <vcolbert@nvidia.com>
-rw-r--r--drivers/video/tegra/nvmap.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/video/tegra/nvmap.c b/drivers/video/tegra/nvmap.c
index 771f3ef133d7..29594e013a35 100644
--- a/drivers/video/tegra/nvmap.c
+++ b/drivers/video/tegra/nvmap.c
@@ -1036,7 +1036,9 @@ void _nvmap_handle_free(struct nvmap_handle *h)
}
/* ensure that no stale data remains in the cache for this handle */
- e = _nvmap_do_cache_maint(h, 0, h->size, NVMEM_CACHE_OP_WB_INV, false);
+ if (h->alloc || h->pgalloc)
+ e = _nvmap_do_cache_maint(h, 0, h->size,
+ NVMEM_CACHE_OP_WB_INV, false);
if (h->alloc && !h->heap_pgalloc)
nvmap_carveout_free(h->carveout.co_heap, h->carveout.block_idx);