mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-22 17:36:20 +03:00
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:
@@ -94,6 +94,10 @@ void nvgpu_gr_global_ctx_buffer_free(struct gk20a *g,
|
|||||||
{
|
{
|
||||||
u32 i;
|
u32 i;
|
||||||
|
|
||||||
|
if (desc == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < NVGPU_GR_GLOBAL_CTX_COUNT; i++) {
|
for (i = 0; i < NVGPU_GR_GLOBAL_CTX_COUNT; i++) {
|
||||||
if (desc[i].destroy != NULL) {
|
if (desc[i].destroy != NULL) {
|
||||||
desc[i].destroy(g, &desc[i].mem);
|
desc[i].destroy(g, &desc[i].mem);
|
||||||
|
|||||||
@@ -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.su_coalesce(g, 0);
|
||||||
g->ops.gr.init.lg_coalesce(g, 0);
|
g->ops.gr.init.lg_coalesce(g, 0);
|
||||||
|
|
||||||
|
#ifdef CONFIG_NVGPU_GRAPHICS
|
||||||
if (g->ops.gr.init.preemption_state != NULL) {
|
if (g->ops.gr.init.preemption_state != NULL) {
|
||||||
err = g->ops.gr.init.preemption_state(g);
|
err = g->ops.gr.init.preemption_state(g);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* floorsweep anything left */
|
/* floorsweep anything left */
|
||||||
err = nvgpu_gr_fs_state_init(g, gr->config);
|
err = nvgpu_gr_fs_state_init(g, gr->config);
|
||||||
|
|||||||
@@ -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)
|
void nvgpu_gr_config_deinit(struct gk20a *g, struct nvgpu_gr_config *config)
|
||||||
{
|
{
|
||||||
|
if (config == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
gr_config_free_mem(g, config);
|
gr_config_free_mem(g, config);
|
||||||
#ifdef CONFIG_NVGPU_GRAPHICS
|
#ifdef CONFIG_NVGPU_GRAPHICS
|
||||||
nvgpu_kfree(g, config->map_tiles);
|
nvgpu_kfree(g, config->map_tiles);
|
||||||
|
|||||||
@@ -899,6 +899,10 @@ int nvgpu_gr_obj_ctx_init(struct gk20a *g,
|
|||||||
void nvgpu_gr_obj_ctx_deinit(struct gk20a *g,
|
void nvgpu_gr_obj_ctx_deinit(struct gk20a *g,
|
||||||
struct nvgpu_gr_obj_ctx_golden_image *golden_image)
|
struct nvgpu_gr_obj_ctx_golden_image *golden_image)
|
||||||
{
|
{
|
||||||
|
if (golden_image == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (golden_image->local_golden_image != NULL) {
|
if (golden_image->local_golden_image != NULL) {
|
||||||
nvgpu_gr_global_ctx_deinit_local_golden_image(g,
|
nvgpu_gr_global_ctx_deinit_local_golden_image(g,
|
||||||
golden_image->local_golden_image);
|
golden_image->local_golden_image);
|
||||||
|
|||||||
@@ -610,6 +610,10 @@ void nvgpu_netlist_deinit_ctx_vars(struct gk20a *g)
|
|||||||
{
|
{
|
||||||
struct nvgpu_netlist_vars *netlist_vars = g->netlist_vars;
|
struct nvgpu_netlist_vars *netlist_vars = g->netlist_vars;
|
||||||
|
|
||||||
|
if (netlist_vars == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
g->netlist_valid = false;
|
g->netlist_valid = false;
|
||||||
nvgpu_kfree(g, netlist_vars->ucode.fecs.inst.l);
|
nvgpu_kfree(g, netlist_vars->ucode.fecs.inst.l);
|
||||||
nvgpu_kfree(g, netlist_vars->ucode.fecs.data.l);
|
nvgpu_kfree(g, netlist_vars->ucode.fecs.data.l);
|
||||||
|
|||||||
Reference in New Issue
Block a user