]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
gpu: nvgpu: fix memory leak of dbg_session
authorDeepak Nibade <dnibade@nvidia.com>
Thu, 5 Jun 2014 05:56:59 +0000 (11:26 +0530)
committerEmad Mir <emir@nvidia.com>
Fri, 6 Jun 2014 17:17:50 +0000 (10:17 -0700)
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/419582
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c

index 816990a014fa8ad15bf1ac9ceb22d4ecb69317a0..ffd7ec083d951568bd74fac217662bb22ba37531 100644 (file)
@@ -301,9 +301,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;