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
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Shridhar Rasal <srasal@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
This commit is contained in:
Deepak Nibade
2014-06-05 11:26:59 +05:30
committed by Dan Willemsen
parent 6b33379c55
commit ccbe6c44d3

View File

@@ -299,8 +299,7 @@ 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)); gk20a_dbg(gpu_dbg_gpu_dbg | gpu_dbg_fn, "%s", dev_name(dbg_s->dev));
/* unbind if it was bound */ /* unbind if it was bound */
if (!dbg_s->ch) if (dbg_s->ch)
return 0;
dbg_unbind_channel_gk20a(dbg_s); dbg_unbind_channel_gk20a(dbg_s);
kfree(dbg_s); kfree(dbg_s);