gpu: nvgpu: Uninitialized pointer read

Fix the following Coverity Defect:
vm_remap.c : Uninitialized pointer read

CID 10127932

Bug 3460991

Signed-off-by: Jinesh Parakh <jparakh@nvidia.com>
Change-Id: I2de290882aec6a859c5280998e11fb75f3395302
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2708539
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
GVS: Gerrit_Virtual_Submit
This commit is contained in:
Jinesh Parakh
2022-05-06 10:47:24 +05:30
committed by mobile promotions
parent bb73cf9597
commit 7d50efb6bc

View File

@@ -43,7 +43,7 @@ int nvgpu_vm_remap_os_buf_get(struct vm_gk20a *vm,
struct dma_buf *dmabuf; struct dma_buf *dmabuf;
struct sg_table *sgt = NULL; struct sg_table *sgt = NULL;
struct nvgpu_sgt *nv_sgt = NULL; struct nvgpu_sgt *nv_sgt = NULL;
struct dma_buf_attachment *attachment; struct dma_buf_attachment *attachment = NULL;
enum nvgpu_aperture aperture; enum nvgpu_aperture aperture;
enum dma_data_direction dmabuf_direction; enum dma_data_direction dmabuf_direction;
int err = 0; int err = 0;
@@ -105,7 +105,7 @@ int nvgpu_vm_remap_os_buf_get(struct vm_gk20a *vm,
return 0; return 0;
clean_up: clean_up:
if (IS_ERR(sgt)) { if (!IS_ERR(sgt)) {
nvgpu_mm_unpin(dev, dmabuf, attachment, sgt); nvgpu_mm_unpin(dev, dmabuf, attachment, sgt);
} }
dma_buf_put(dmabuf); dma_buf_put(dmabuf);