Commits

Anonymous committed 8722d5e

video: tegra: host: better error handling in alloc_gathers()

We should return -ENOMEM in alloc_gathers() when get a NULL pointer
from nvmap_alloc() or nvmap_mmap()

Bug 1178135

Change-Id: I29321710343983a6e733d95b10a1f7eb586246c0
Signed-off-by: Haley Teng <hteng@nvidia.com>

Comments (0)

Files changed (1)

drivers/video/tegra/host/nvhost_job.c

 				32, NVMAP_HANDLE_CACHEABLE, 0);
 		if (IS_ERR_OR_NULL(job->gather_mem)) {
 			err = PTR_ERR(job->gather_mem);
+			if (!job->gather_mem)
+				err = -ENOMEM;
 			job->gather_mem = NULL;
 			goto error;
 		}
 		job->gathers = nvmap_mmap(job->gather_mem);
 		if (IS_ERR_OR_NULL(job->gathers)) {
 			err = PTR_ERR(job->gathers);
+			if (!job->gathers)
+				err = -ENOMEM;
 			job->gathers = NULL;
 			goto error;
 		}