From dccb63896018b7ce6a80d391b538e815f5a4719b Mon Sep 17 00:00:00 2001 From: Pritesh Raithatha Date: Tue, 10 Jul 2018 12:51:43 +0530 Subject: video: tegra: nvmap: fix return value check of dma_declare_coherent_memory Kernel-4.9 and before dma_declare_coherent_memory function was not reporting failure. We updated the code to return the same mapping flag(MAP/NOMAP/IO) in case of succeed. Kernel-4.14 upstream is updated to return error in case of failure so updating return value check in nvmap heap. Bug 200415588 Change-Id: I4222438a80516d9c78f7cd9d4325a00cccb463df Signed-off-by: Pritesh Raithatha Reviewed-on: https://git-master.nvidia.com/r/1774909 Reviewed-by: svc-mobile-coverity Reviewed-by: Krishna Reddy Reviewed-by: David Gilhooley Reviewed-by: Sachin Nikam --- drivers/video/tegra/nvmap/nvmap_heap.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/video/tegra/nvmap/nvmap_heap.c b/drivers/video/tegra/nvmap/nvmap_heap.c index 19b9f273f..5c1c44951 100644 --- a/drivers/video/tegra/nvmap/nvmap_heap.c +++ b/drivers/video/tegra/nvmap/nvmap_heap.c @@ -422,7 +422,11 @@ struct nvmap_heap *nvmap_heap_create(struct device *parent, /* declare Non-CMA heap */ err = dma_declare_coherent_memory(h->dma_dev, 0, base, len, DMA_MEMORY_NOMAP | DMA_MEMORY_EXCLUSIVE); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0) + if (!err) { +#else if (err & DMA_MEMORY_NOMAP) { +#endif dev_info(parent, "%s :dma coherent mem declare %pa,%zu\n", co->name, &base, len); -- cgit v1.2.2