summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c
diff options
context:
space:
mode:
authorDeepak Nibade <dnibade@nvidia.com>2017-03-08 04:48:06 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2017-03-14 14:46:53 -0400
commitd6e46c4d37fb29eb552da500243feca9f2bb56e6 (patch)
tree395bc8830482e6eafbb9f204fe867132f4ef0443 /drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c
parentce810756ba94b160dd4c39511a72ef853c5ee66f (diff)
gpu: nvgpu: check return value of mutex_init in dbg_gpu_gk20a.c
- check return value of nvgpu_mutex_init in dbg_gpu_gk20a.c - add corresponding nvgpu_mutex_destroy calls Jira NVGPU-13 Change-Id: I153ef2dd17d0fe17b3f38f6fa7e165d1aeaa2a42 Signed-off-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-on: http://git-master/r/1317135 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/dbg_gpu_gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c b/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c
index 6a32d727..821951ad 100644
--- a/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c
@@ -118,12 +118,22 @@ static int gk20a_dbg_gpu_do_dev_open(struct inode *inode,
118 118
119 init_waitqueue_head(&dbg_session->dbg_events.wait_queue); 119 init_waitqueue_head(&dbg_session->dbg_events.wait_queue);
120 INIT_LIST_HEAD(&dbg_session->ch_list); 120 INIT_LIST_HEAD(&dbg_session->ch_list);
121 nvgpu_mutex_init(&dbg_session->ch_list_lock); 121 err = nvgpu_mutex_init(&dbg_session->ch_list_lock);
122 nvgpu_mutex_init(&dbg_session->ioctl_lock); 122 if (err)
123 goto err_free_session;
124 err = nvgpu_mutex_init(&dbg_session->ioctl_lock);
125 if (err)
126 goto err_destroy_lock;
123 dbg_session->dbg_events.events_enabled = false; 127 dbg_session->dbg_events.events_enabled = false;
124 dbg_session->dbg_events.num_pending_events = 0; 128 dbg_session->dbg_events.num_pending_events = 0;
125 129
126 return 0; 130 return 0;
131
132err_destroy_lock:
133 nvgpu_mutex_destroy(&dbg_session->ch_list_lock);
134err_free_session:
135 kfree(dbg_session);
136 return err;
127} 137}
128 138
129/* used in scenarios where the debugger session can take just the inter-session 139/* used in scenarios where the debugger session can take just the inter-session
@@ -480,6 +490,9 @@ int gk20a_dbg_gpu_dev_release(struct inode *inode, struct file *filp)
480 nvgpu_dbg_timeout_enable(dbg_s, NVGPU_DBG_GPU_IOCTL_TIMEOUT_ENABLE); 490 nvgpu_dbg_timeout_enable(dbg_s, NVGPU_DBG_GPU_IOCTL_TIMEOUT_ENABLE);
481 nvgpu_mutex_release(&g->dbg_sessions_lock); 491 nvgpu_mutex_release(&g->dbg_sessions_lock);
482 492
493 nvgpu_mutex_destroy(&dbg_s->ch_list_lock);
494 nvgpu_mutex_destroy(&dbg_s->ioctl_lock);
495
483 kfree(dbg_s); 496 kfree(dbg_s);
484 return 0; 497 return 0;
485} 498}