summaryrefslogtreecommitdiff
path: root/drivers/gpu
diff options
context:
space:
mode:
authorDeepak Nibade <dnibade@nvidia.com>2014-06-05 11:26:59 +0530
committerRiham Haidar <rhaidar@nvidia.com>2014-06-06 13:16:57 -0700
commitd5bebaf72a9aae9401f1336850165d372bc960af (patch)
tree2f06ea440da5d50d9e9cb6b8f258625c0b378bc0 /drivers/gpu
parent149d1fb775b1876831db7896b63002b0cab04dc1 (diff)
gpu: nvgpu: fix memory leak of dbg_session
In gk20a_dbg_gpu_dev_release() (when we close nvhost-dgb-gpu sysfs), we return from function if there is no channel bound to dbg_session without freeing the dbg_session memory. If there is no channel bound then do not call dbg_unbind_channel_gk20a() and then free dbg_session memory always. Bug 200010382 Change-Id: I90dd2ed3cd72fbc5d429799660daf2a09b974fda Signed-off-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-on: http://git-master/r/419306 (cherry picked from commit aed69a3f2c2ddc6b9b04fff4be6c4771f206f1d6) Reviewed-on: http://git-master/r/419583 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c b/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c
index d1dbf1b62d9c..07a48eea9f0c 100644
--- a/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c
@@ -299,9 +299,8 @@ int gk20a_dbg_gpu_dev_release(struct inode *inode, struct file *filp)
gk20a_dbg(gpu_dbg_gpu_dbg | gpu_dbg_fn, "%s", dev_name(dbg_s->dev));
/* unbind if it was bound */
- if (!dbg_s->ch)
- return 0;
- dbg_unbind_channel_gk20a(dbg_s);
+ if (dbg_s->ch)
+ dbg_unbind_channel_gk20a(dbg_s);
kfree(dbg_s);
return 0;