From ccbe6c44d32578ef4b5e15cfcc61f9dc86702c6b Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Thu, 5 Jun 2014 11:26:59 +0530 Subject: 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 Reviewed-on: http://git-master/r/419306 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Shridhar Rasal Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'drivers') diff --git a/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c b/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c index 77806a5e..7a1140f9 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; -- cgit v1.2.2