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: Sylwester Nawrocki <[email protected]>
Acked-by: Kyungmin Park <[email protected]>
Cc: [email protected] # for v3.15
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
{
struct device *dev = &is->pdev->dev;
+ if (is->memory.vaddr == NULL)
+ return;
+
dma_free_coherent(dev, is->memory.size, is->memory.vaddr,
is->memory.paddr);
}