From 97aa9f705a84186ef0f7f31487988cfd5a8a94e8 Mon Sep 17 00:00:00 2001 From: Konsta Holtta Date: Tue, 4 Sep 2018 15:10:24 +0300 Subject: gpu: nvgpu: fix bad error code in gmmu map __nvgpu_gmmu_map() does not currently have a mechanism for returning an error code if something goes wrong; it just returns zero on error, or a nonzero address when mapping was successful. Change it to return 0 instead of -ENOMEM if the creation of nvgpu_sgt from mem fails. Out of memory is the only meaningful failure case anyway, and this -ENOMEM would just look like a (huge) memory address. Change-Id: If176e165b1f9a8fa84a1bdf3080c9059a193081f Signed-off-by: Konsta Holtta Reviewed-on: https://git-master.nvidia.com/r/1812491 Reviewed-by: svc-misra-checker GVS: Gerrit_Virtual_Submit Reviewed-by: Alex Waterman Reviewed-by: Terje Bergstrom Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/mm/gmmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/gpu/nvgpu/common/mm/gmmu.c') diff --git a/drivers/gpu/nvgpu/common/mm/gmmu.c b/drivers/gpu/nvgpu/common/mm/gmmu.c index 47d1e8ee..686d0e35 100644 --- a/drivers/gpu/nvgpu/common/mm/gmmu.c +++ b/drivers/gpu/nvgpu/common/mm/gmmu.c @@ -80,7 +80,7 @@ static u64 __nvgpu_gmmu_map(struct vm_gk20a *vm, struct nvgpu_sgt *sgt = nvgpu_sgt_create_from_mem(g, mem); if (!sgt) { - return -ENOMEM; + return 0; } /* -- cgit v1.2.2