gpu: nvgpu: MISRA 14.4 err/ret/status as boolean

MISRA rule 14.4 doesn't allow the usage of integer types as booleans
in the controlling expression of an if statement or an iteration
statement

Fix violations where the integer variables err, ret, status are used
as booleans in the controlling expression of if and loop statements.

JIRA NVGPU-1019

Change-Id: Ia950828797b8eff4bc754269ea2d9fa272f59436
Signed-off-by: Amurthyreddy <amurthyreddy@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1919111
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Scott Long <scottl@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Amurthyreddy
2018-10-04 15:33:16 +05:30
committed by Abdul Salam
parent 8033d33982
commit c114b9e77e
27 changed files with 245 additions and 245 deletions

View File

@@ -278,7 +278,7 @@ static int pd_allocate(struct vm_gk20a *vm,
}
err = nvgpu_pd_alloc(vm, pd, pd_size(l, attrs));
if (err) {
if (err != 0) {
nvgpu_info(vm->mm->g, "error allocating page directory!");
return err;
}
@@ -451,7 +451,7 @@ static int __set_pd_level(struct vm_gk20a *vm,
chunk_size,
attrs);
if (err) {
if (err != 0) {
return err;
}
}
@@ -560,7 +560,7 @@ static int __nvgpu_gmmu_do_update_page_table(struct vm_gk20a *vm,
virt_addr,
chunk_length,
attrs);
if (err) {
if (err != 0) {
break;
}
@@ -740,7 +740,7 @@ u64 gk20a_locked_gmmu_map(struct vm_gk20a *vm,
err = __nvgpu_gmmu_update_page_table(vm, sgt, buffer_offset,
vaddr, size, &attrs);
if (err) {
if (err != 0) {
nvgpu_err(g, "failed to update ptes on map");
goto fail_validate;
}
@@ -793,7 +793,7 @@ void gk20a_locked_gmmu_unmap(struct vm_gk20a *vm,
/* unmap here needs to know the page size we assigned at mapping */
err = __nvgpu_gmmu_update_page_table(vm, NULL, 0,
vaddr, size, &attrs);
if (err) {
if (err != 0) {
nvgpu_err(g, "failed to update gmmu ptes on unmap");
}
@@ -929,7 +929,7 @@ int __nvgpu_set_pte(struct gk20a *g, struct vm_gk20a *vm, u64 vaddr, u32 *pte)
err = __nvgpu_locate_pte(g, vm, &vm->pdb,
vaddr, 0, &attrs,
NULL, &pd, &pd_idx, &pd_offs);
if (err) {
if (err != 0) {
return err;
}