gpu: nvgpu: fix misra errors in gr units

Fix misra errors in gr units

misra 14.3 rule - there shall be no dead code.
misra_c_2012_rule_14_3_violation: The condition
"graphics_preempt_mode != 0U" cannot be true.

misra_c_2012_rule_16_1_violation: The switch statement is not
well formed.

misra_c_2012_rule_10_8_violation: Cast from 32 bit width expression
"(regval >> 1U) & 1U" to a wider 64 bit type.

Jira NVGPU-3872

Change-Id: Ibb53d0756d464d2ae3279d1b841b3c91a16df9be
Signed-off-by: Vinod G <vinodg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2182562
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Seshendra Gadagottu <sgadagottu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Vinod G
2019-08-23 16:41:02 -07:00
committed by mobile promotions
parent 0a9f633fc3
commit 70a2a1bfcb
4 changed files with 18 additions and 14 deletions

View File

@@ -69,9 +69,11 @@ static int nvgpu_gr_obj_ctx_init_ctxsw_preemption_mode(struct gk20a *g,
struct nvgpu_gr_ctx *gr_ctx, struct vm_gk20a *vm,
u32 class_num, u32 flags)
{
#if defined(CONFIG_NVGPU_GRAPHICS) || defined(CONFIG_NVGPU_CILP)
int err;
u32 graphics_preempt_mode = 0;
u32 compute_preempt_mode = 0;
u32 graphics_preempt_mode = 0U;
u32 compute_preempt_mode = 0U;
#endif
nvgpu_log_fn(g, " ");
@@ -81,7 +83,6 @@ static int nvgpu_gr_obj_ctx_init_ctxsw_preemption_mode(struct gk20a *g,
nvgpu_gr_ctx_init_compute_preemption_mode(gr_ctx,
NVGPU_PREEMPTION_MODE_COMPUTE_CTA);
}
return 0;
}
@@ -96,6 +97,7 @@ static int nvgpu_gr_obj_ctx_init_ctxsw_preemption_mode(struct gk20a *g,
}
#endif
#if defined(CONFIG_NVGPU_GRAPHICS) || defined(CONFIG_NVGPU_CILP)
if ((graphics_preempt_mode != 0U) || (compute_preempt_mode != 0U)) {
err = nvgpu_gr_obj_ctx_set_ctxsw_preemption_mode(g, config,
gr_ctx_desc, gr_ctx, vm, class_num, graphics_preempt_mode,
@@ -105,6 +107,7 @@ static int nvgpu_gr_obj_ctx_init_ctxsw_preemption_mode(struct gk20a *g,
return err;
}
}
#endif
nvgpu_log_fn(g, "done");
@@ -204,9 +207,6 @@ static int nvgpu_gr_obj_ctx_set_compute_preemption_mode(struct gk20a *g,
return 0;
}
int nvgpu_gr_obj_ctx_set_ctxsw_preemption_mode(struct gk20a *g,
struct nvgpu_gr_config *config, struct nvgpu_gr_ctx_desc *gr_ctx_desc,
struct nvgpu_gr_ctx *gr_ctx, struct vm_gk20a *vm, u32 class_num,
@@ -537,7 +537,7 @@ restore_fe_go_idle:
#ifdef CONFIG_NVGPU_GR_GOLDEN_CTX_VERIFICATION
/* restore stats bundle data through mme shadow methods */
if (g->ops.gr.init.restore_stats_counter_bundle_data != 0) {
if (g->ops.gr.init.restore_stats_counter_bundle_data != NULL) {
g->ops.gr.init.restore_stats_counter_bundle_data(g,
sw_bundle_init);
}