gpu: nvgpu: fix MISRA 17.7 violation in gr.obj_ctx unit

Below MISRA 17.7 violation is reported in common.gr.obj_ctx unit

nvgpu/drivers/gpu/nvgpu/common/gr/obj_ctx.c:603:
misra_c_2012_rule_17_7: The return value of a non-void function
"nvgpu_gr_obj_ctx_init_ctxsw_preemption_mode" is unused.

Fix this by adding a check for return value of above function

Jira NVGPU-3407

Change-Id: I53467ab3e5ff9dc9dd7f194b3d67649f81fa0546
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2114365
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vinod Gopalakrishnakurup <vinodg@nvidia.com>
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:
Deepak Nibade
2019-05-03 17:03:26 +05:30
committed by mobile promotions
parent 8c0ddd722d
commit 92a7cebea6

View File

@@ -578,8 +578,7 @@ int nvgpu_gr_obj_ctx_alloc(struct gk20a *g,
err = nvgpu_gr_obj_ctx_gr_ctx_alloc(g, golden_image, gr_ctx_desc,
gr_ctx, vm);
if (err != 0) {
nvgpu_err(g,
"fail to allocate TSG gr ctx buffer");
nvgpu_err(g, "fail to allocate TSG gr ctx buffer");
goto out;
}
@@ -594,27 +593,30 @@ int nvgpu_gr_obj_ctx_alloc(struct gk20a *g,
err = nvgpu_gr_ctx_alloc_patch_ctx(g, gr_ctx, gr_ctx_desc, vm);
if (err != 0) {
nvgpu_err(g,
"fail to allocate patch buffer");
nvgpu_err(g, "fail to allocate patch buffer");
goto out;
}
}
nvgpu_gr_obj_ctx_init_ctxsw_preemption_mode(g, config, gr_ctx_desc,
gr_ctx, vm, class_num, flags);
err = nvgpu_gr_obj_ctx_init_ctxsw_preemption_mode(g, config,
gr_ctx_desc, gr_ctx, vm, class_num, flags);
if (err != 0) {
nvgpu_err(g, "fail to init preemption mode");
goto out;
}
/* map global buffer to channel gpu_va and commit */
err = nvgpu_gr_ctx_map_global_ctx_buffers(g, gr_ctx,
global_ctx_buffer, vm, vpr);
if (err != 0) {
nvgpu_err(g,
"fail to map global ctx buffer");
nvgpu_err(g, "fail to map global ctx buffer");
goto out;
}
err = nvgpu_gr_obj_ctx_commit_global_ctx_buffers(g, global_ctx_buffer,
config, gr_ctx, true);
if (err != 0) {
nvgpu_err(g, "fail to commit global ctx buffer");
goto out;
}
@@ -626,8 +628,7 @@ int nvgpu_gr_obj_ctx_alloc(struct gk20a *g,
err = nvgpu_gr_obj_ctx_alloc_golden_ctx_image(g, golden_image,
global_ctx_buffer, config, gr_ctx, inst_block);
if (err != 0) {
nvgpu_err(g,
"fail to init golden ctx image");
nvgpu_err(g, "fail to init golden ctx image");
goto out;
}
@@ -635,8 +636,7 @@ int nvgpu_gr_obj_ctx_alloc(struct gk20a *g,
err = nvgpu_gr_ctx_load_golden_ctx_image(g, gr_ctx,
golden_image->local_golden_image, cde);
if (err != 0) {
nvgpu_err(g,
"fail to load golden ctx image");
nvgpu_err(g, "fail to load golden ctx image");
goto out;
}