diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c b/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c index 05c53a66..2c88b08e 100644 --- a/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c | |||
@@ -573,15 +573,20 @@ static int gk20a_fecs_trace_init(struct gk20a *g) | |||
573 | } | 573 | } |
574 | g->fecs_trace = trace; | 574 | g->fecs_trace = trace; |
575 | 575 | ||
576 | err = nvgpu_mutex_init(&trace->poll_lock); | ||
577 | if (err) | ||
578 | goto clean; | ||
579 | err = nvgpu_mutex_init(&trace->hash_lock); | ||
580 | if (err) | ||
581 | goto clean_poll_lock; | ||
582 | |||
576 | BUG_ON(!is_power_of_2(GK20A_FECS_TRACE_NUM_RECORDS)); | 583 | BUG_ON(!is_power_of_2(GK20A_FECS_TRACE_NUM_RECORDS)); |
577 | err = gk20a_fecs_trace_alloc_ring(g); | 584 | err = gk20a_fecs_trace_alloc_ring(g); |
578 | if (err) { | 585 | if (err) { |
579 | gk20a_warn(dev_from_gk20a(g), "failed to allocate FECS ring"); | 586 | gk20a_warn(dev_from_gk20a(g), "failed to allocate FECS ring"); |
580 | goto clean; | 587 | goto clean_hash_lock; |
581 | } | 588 | } |
582 | 589 | ||
583 | nvgpu_mutex_init(&trace->poll_lock); | ||
584 | nvgpu_mutex_init(&trace->hash_lock); | ||
585 | hash_init(trace->pid_hash_table); | 590 | hash_init(trace->pid_hash_table); |
586 | 591 | ||
587 | g->gpu_characteristics.flags |= | 592 | g->gpu_characteristics.flags |= |
@@ -590,6 +595,10 @@ static int gk20a_fecs_trace_init(struct gk20a *g) | |||
590 | gk20a_fecs_trace_debugfs_init(g); | 595 | gk20a_fecs_trace_debugfs_init(g); |
591 | return 0; | 596 | return 0; |
592 | 597 | ||
598 | clean_hash_lock: | ||
599 | nvgpu_mutex_destroy(&trace->hash_lock); | ||
600 | clean_poll_lock: | ||
601 | nvgpu_mutex_destroy(&trace->poll_lock); | ||
593 | clean: | 602 | clean: |
594 | kfree(trace); | 603 | kfree(trace); |
595 | g->fecs_trace = NULL; | 604 | g->fecs_trace = NULL; |
@@ -700,6 +709,9 @@ static int gk20a_fecs_trace_deinit(struct gk20a *g) | |||
700 | gk20a_fecs_trace_free_ring(g); | 709 | gk20a_fecs_trace_free_ring(g); |
701 | gk20a_fecs_trace_free_hash_table(g); | 710 | gk20a_fecs_trace_free_hash_table(g); |
702 | 711 | ||
712 | nvgpu_mutex_destroy(&g->fecs_trace->hash_lock); | ||
713 | nvgpu_mutex_destroy(&g->fecs_trace->poll_lock); | ||
714 | |||
703 | kfree(g->fecs_trace); | 715 | kfree(g->fecs_trace); |
704 | g->fecs_trace = NULL; | 716 | g->fecs_trace = NULL; |
705 | return 0; | 717 | return 0; |