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>
This commit is contained in:
Deepak Nibade
2017-03-08 15:18:06 +05:30
committed by mobile promotions
parent ce810756ba
commit d6e46c4d37

View File

@@ -118,12 +118,22 @@ static int gk20a_dbg_gpu_do_dev_open(struct inode *inode,
init_waitqueue_head(&dbg_session->dbg_events.wait_queue);
INIT_LIST_HEAD(&dbg_session->ch_list);
nvgpu_mutex_init(&dbg_session->ch_list_lock);
nvgpu_mutex_init(&dbg_session->ioctl_lock);
err = nvgpu_mutex_init(&dbg_session->ch_list_lock);
if (err)
goto err_free_session;
err = nvgpu_mutex_init(&dbg_session->ioctl_lock);
if (err)
goto err_destroy_lock;
dbg_session->dbg_events.events_enabled = false;
dbg_session->dbg_events.num_pending_events = 0;
return 0;
err_destroy_lock:
nvgpu_mutex_destroy(&dbg_session->ch_list_lock);
err_free_session:
kfree(dbg_session);
return err;
}
/* 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)
nvgpu_dbg_timeout_enable(dbg_s, NVGPU_DBG_GPU_IOCTL_TIMEOUT_ENABLE);
nvgpu_mutex_release(&g->dbg_sessions_lock);
nvgpu_mutex_destroy(&dbg_s->ch_list_lock);
nvgpu_mutex_destroy(&dbg_s->ioctl_lock);
kfree(dbg_s);
return 0;
}