diff options
author | Deepak Nibade <dnibade@nvidia.com> | 2017-03-08 04:49:16 -0500 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-03-14 14:46:53 -0400 |
commit | 7dfc81d66306fd0576677f43cc3d4c5cf7e95193 (patch) | |
tree | 089004e57678992e3d1e45b1e1328aaa1e2857bb /drivers/gpu/nvgpu/gk20a | |
parent | d6e46c4d37fb29eb552da500243feca9f2bb56e6 (diff) |
gpu: nvgpu: check return value of mutex_init in fecs_trace_gk20a.c
- check return value of nvgpu_mutex_init in fecs_trace_gk20a.c
- add corresponding nvgpu_mutex_destroy calls
Jira NVGPU-13
Change-Id: I1fe9dd31bbc084bf66dd73dd26b395d898fde9c4
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/1317136
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: Navneet Kumar <navneetk@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a')
-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; |