Commit 404a90ab authored by Sylwester Nawrocki's avatar Sylwester Nawrocki Committed by Mauro Carvalho Chehab

[media] exynos4-is: Free FIMC-IS CPU memory only when allocated

Ensure dma_free_coherent() is not called with incorrect arguments
and only when the memory was actually allocated. This will prevent
possible crashes on error paths of the top level media device driver,
when fimc-is device gets unregistered and its driver detached.
Signed-off-by: default avatarSylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
Cc: stable@vger.kernel.org # for v3.15
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent f486e7c3
...@@ -367,6 +367,9 @@ static void fimc_is_free_cpu_memory(struct fimc_is *is) ...@@ -367,6 +367,9 @@ static void fimc_is_free_cpu_memory(struct fimc_is *is)
{ {
struct device *dev = &is->pdev->dev; struct device *dev = &is->pdev->dev;
if (is->memory.vaddr == NULL)
return;
dma_free_coherent(dev, is->memory.size, is->memory.vaddr, dma_free_coherent(dev, is->memory.size, is->memory.vaddr,
is->memory.paddr); is->memory.paddr);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment