gpu: nvgpu: Fix mutex MISRA 17.7 violations

MISRA Rule-17.7 requires the return value of all functions to be used.
Fix is either to use the return value or change the function to return
void. This patch contains fix for calls to nvgpu_mutex_init and
improves related error handling.

JIRA NVGPU-677

Change-Id: I609fa138520cc7ccfdd5aa0e7fd28c8ca0b3a21c
Signed-off-by: Nicolas Benech <nbenech@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1805598
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Nicolas Benech
2018-08-23 16:23:52 -04:00
committed by mobile promotions
parent b44c7fdb11
commit 2eface802a
18 changed files with 168 additions and 68 deletions

View File

@@ -284,7 +284,7 @@ int __nvgpu_vm_init(struct mm_gk20a *mm,
bool userspace_managed,
char *name)
{
int err;
int err = 0;
char alloc_name[32];
u64 kernel_vma_flags;
u64 user_vma_start, user_vma_limit;
@@ -476,8 +476,19 @@ int __nvgpu_vm_init(struct mm_gk20a *mm,
vm->mapped_buffers = NULL;
nvgpu_mutex_init(&vm->syncpt_ro_map_lock);
nvgpu_mutex_init(&vm->update_gmmu_lock);
err = nvgpu_mutex_init(&vm->syncpt_ro_map_lock);
if (err != 0) {
nvgpu_err(g,
"Error in syncpt_ro_map_lock mutex initialization");
goto clean_up_allocators;
}
err = nvgpu_mutex_init(&vm->update_gmmu_lock);
if (err != 0) {
nvgpu_err(g, "Error in update_gmmu_lock mutex initialization");
goto clean_up_ro_map_lock;
}
nvgpu_ref_init(&vm->ref);
nvgpu_init_list_node(&vm->vm_area_list);
@@ -489,12 +500,16 @@ int __nvgpu_vm_init(struct mm_gk20a *mm,
if (vm->va_limit > 4ULL * SZ_1G) {
err = nvgpu_init_sema_pool(vm);
if (err) {
goto clean_up_allocators;
goto clean_up_gmmu_lock;
}
}
return 0;
clean_up_gmmu_lock:
nvgpu_mutex_destroy(&vm->update_gmmu_lock);
clean_up_ro_map_lock:
nvgpu_mutex_destroy(&vm->syncpt_ro_map_lock);
clean_up_allocators:
if (nvgpu_alloc_initialized(&vm->kernel)) {
nvgpu_alloc_destroy(&vm->kernel);