Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3946e8f0 authored by Rajesh Kemisetti's avatar Rajesh Kemisetti Committed by Stephen Boyd
Browse files

msm: kgsl: Add a check to free the kgsl_timeline object.



Add a check to free the kgsl_timeline object only after
destroy flag is set. This is to avoid further references to timeline
from kgsl if it is already freed and also to catch any unbalanced
kref count.

Change-Id: I8017b9a928a26b703eb92b17ab6a361e4b479e5a
Signed-off-by: default avatarRajesh Kemisetti <rajeshk@codeaurora.org>
parent dc9688db
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -220,6 +220,15 @@ static void kgsl_sync_pt_value_str(struct sync_pt *sync_pt,
	snprintf(str, size, "%u", kpt->timestamp);
}

static void kgsl_sync_timeline_release_obj(struct sync_timeline *sync_timeline)
{
	/*
	 * Make sure to free the timeline only after destroy flag is set.
	 * This is to avoid further accessing to the timeline from KGSL and
	 * also to catch any unbalanced kref of timeline.
	 */
	BUG_ON(sync_timeline && (sync_timeline->destroyed != true));
}
static const struct sync_timeline_ops kgsl_sync_timeline_ops = {
	.driver_name = "kgsl-timeline",
	.dup = kgsl_sync_pt_dup,
@@ -227,6 +236,7 @@ static const struct sync_timeline_ops kgsl_sync_timeline_ops = {
	.compare = kgsl_sync_pt_compare,
	.timeline_value_str = kgsl_sync_timeline_value_str,
	.pt_value_str = kgsl_sync_pt_value_str,
	.release_obj = kgsl_sync_timeline_release_obj,
};

int kgsl_sync_timeline_create(struct kgsl_context *context)