mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-22 17:36:20 +03:00
gpu: nvgpu: fix uninitialized variable error
Enabling Kcov and KASAN causes below compilation failure : common/mm/vm_area.c:255:3: error: ‘vma’ may be used uninitialized in this function [-Werror=maybe-uninitialized] Fix this by correcting failure cases in function nvgpu_vm_area_alloc() Bug 2155608 Change-Id: Id4070157f2a8bd7043b0c49effb6f61cce5eecc2 Signed-off-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2359496 Reviewed-by: automaticguardword <automaticguardword@nvidia.com> Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com> Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com> Reviewed-by: Alex Waterman <alexw@nvidia.com> Reviewed-by: Debarshi Dutta <ddutta@nvidia.com> Reviewed-by: Konsta Holtta <kholtta@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> GVS: Gerrit_Virtual_Submit Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
Alex Waterman
parent
2d24298af0
commit
f807ad932c
@@ -221,13 +221,13 @@ int nvgpu_vm_area_alloc(struct vm_gk20a *vm, u32 pages, u32 page_size,
|
||||
|
||||
vm_area = nvgpu_kzalloc(g, sizeof(*vm_area));
|
||||
if (vm_area == NULL) {
|
||||
goto clean_up_err;
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
vma = vm->vma[pgsz_idx];
|
||||
if (nvgpu_vm_area_alloc_memory(vma, our_addr, pages,
|
||||
page_size, flags, &vaddr_start) != 0) {
|
||||
goto clean_up_err;
|
||||
goto free_vm_area;
|
||||
}
|
||||
|
||||
vm_area->flags = flags;
|
||||
@@ -242,7 +242,7 @@ int nvgpu_vm_area_alloc(struct vm_gk20a *vm, u32 pages, u32 page_size,
|
||||
if (nvgpu_vm_area_alloc_gmmu_map(vm, vm_area, vaddr_start,
|
||||
pgsz_idx, flags) != 0) {
|
||||
nvgpu_mutex_release(&vm->update_gmmu_lock);
|
||||
goto clean_up_err;
|
||||
goto free_vaddr;
|
||||
}
|
||||
|
||||
nvgpu_mutex_release(&vm->update_gmmu_lock);
|
||||
@@ -250,13 +250,10 @@ int nvgpu_vm_area_alloc(struct vm_gk20a *vm, u32 pages, u32 page_size,
|
||||
*addr = vaddr_start;
|
||||
return 0;
|
||||
|
||||
clean_up_err:
|
||||
if (vaddr_start != 0ULL) {
|
||||
free_vaddr:
|
||||
nvgpu_free(vma, vaddr_start);
|
||||
}
|
||||
if (vm_area != NULL) {
|
||||
free_vm_area:
|
||||
nvgpu_kfree(g, vm_area);
|
||||
}
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user