From 8b11d9697c650304b5dc0ca4614c21b7ec96c0dc Mon Sep 17 00:00:00 2001 From: Prakruthi Deepak Heragu Date: Tue, 21 Apr 2020 13:57:00 -0700 Subject: [PATCH] msm: kgsl: Add check not to decrement refcount when debug_fs is disabled As there is no increment in ref_count on context when debug_fs is disabled, ensure there is no decrement in ref_count either. Change-Id: I8da258a78a8b82ee967b1c944209f6777439e682 Signed-off-by: Prakruthi Deepak Heragu --- drivers/gpu/msm/adreno.h | 4 +++- drivers/gpu/msm/adreno_drawctxt.c | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/msm/adreno.h b/drivers/gpu/msm/adreno.h index f1cda8da3c56..e34badc8d3b7 100644 --- a/drivers/gpu/msm/adreno.h +++ b/drivers/gpu/msm/adreno.h @@ -1299,7 +1299,9 @@ void adreno_context_debugfs_init(struct adreno_device *adreno_dev, static inline void adreno_debugfs_init(struct adreno_device *adreno_dev) { } static inline void adreno_context_debugfs_init(struct adreno_device *device, struct adreno_context *context) - { } +{ + context->debug_root = NULL; +} #endif /** diff --git a/drivers/gpu/msm/adreno_drawctxt.c b/drivers/gpu/msm/adreno_drawctxt.c index d42ac6d3bab5..9c83ee2ed354 100644 --- a/drivers/gpu/msm/adreno_drawctxt.c +++ b/drivers/gpu/msm/adreno_drawctxt.c @@ -464,7 +464,8 @@ void adreno_drawctxt_detach(struct kgsl_context *context) debugfs_remove_recursive(drawctxt->debug_root); /* The debugfs file has a reference, release it */ - kgsl_context_put(context); + if (drawctxt->debug_root) + kgsl_context_put(context); /* * internal_timestamp is set in adreno_ringbuffer_addcmds,