gpu: nvgpu: compile out unused code in gr init unit

Add CONFIG_NVGPU_GRAPHICS check before calling
g->gops>gr.init.preemption_state function.

Add NULL checking of pointer before deferecing those
pointers in de_init functions

Jira NVGPU-4676

Change-Id: Id9be0aebdcab4a8fb2b03e92e67c1c207b5b8eab
Signed-off-by: vinodg <vinodg@nvidia.com>
Reviewed-on: http://git-master.nvidia.com/r/c/linux-nvgpu/+/2276898
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
vinodg
2020-01-08 13:34:33 -08:00
committed by Alex Waterman
parent d864904a49
commit a126e00e28
5 changed files with 18 additions and 0 deletions

View File

@@ -94,6 +94,10 @@ void nvgpu_gr_global_ctx_buffer_free(struct gk20a *g,
{
u32 i;
if (desc == NULL) {
return;
}
for (i = 0; i < NVGPU_GR_GLOBAL_CTX_COUNT; i++) {
if (desc[i].destroy != NULL) {
desc[i].destroy(g, &desc[i].mem);

View File

@@ -267,12 +267,14 @@ static int gr_init_setup_hw(struct gk20a *g)
g->ops.gr.init.su_coalesce(g, 0);
g->ops.gr.init.lg_coalesce(g, 0);
#ifdef CONFIG_NVGPU_GRAPHICS
if (g->ops.gr.init.preemption_state != NULL) {
err = g->ops.gr.init.preemption_state(g);
if (err != 0) {
goto out;
}
}
#endif
/* floorsweep anything left */
err = nvgpu_gr_fs_state_init(g, gr->config);

View File

@@ -594,6 +594,10 @@ u32 nvgpu_gr_config_get_gpc_zcb_count(struct nvgpu_gr_config *config,
void nvgpu_gr_config_deinit(struct gk20a *g, struct nvgpu_gr_config *config)
{
if (config == NULL) {
return;
}
gr_config_free_mem(g, config);
#ifdef CONFIG_NVGPU_GRAPHICS
nvgpu_kfree(g, config->map_tiles);

View File

@@ -899,6 +899,10 @@ int nvgpu_gr_obj_ctx_init(struct gk20a *g,
void nvgpu_gr_obj_ctx_deinit(struct gk20a *g,
struct nvgpu_gr_obj_ctx_golden_image *golden_image)
{
if (golden_image == NULL) {
return;
}
if (golden_image->local_golden_image != NULL) {
nvgpu_gr_global_ctx_deinit_local_golden_image(g,
golden_image->local_golden_image);

View File

@@ -610,6 +610,10 @@ void nvgpu_netlist_deinit_ctx_vars(struct gk20a *g)
{
struct nvgpu_netlist_vars *netlist_vars = g->netlist_vars;
if (netlist_vars == NULL) {
return;
}
g->netlist_valid = false;
nvgpu_kfree(g, netlist_vars->ucode.fecs.inst.l);
nvgpu_kfree(g, netlist_vars->ucode.fecs.data.l);