msm: kgsl: Cancel events before context is freed
Make sure the context is intact when the events are canceled. Since
the timestamps are now per-context, readtimestamp requires a valid
context.
Change-Id: I0c917a77f2e39594a5f5b69985f639de1fb53206
Signed-off-by: Lynus Vaz <lvaz@codeaurora.org>
diff --git a/drivers/gpu/msm/kgsl.c b/drivers/gpu/msm/kgsl.c
index 9e9bbf2..7e84692 100644
--- a/drivers/gpu/msm/kgsl.c
+++ b/drivers/gpu/msm/kgsl.c
@@ -718,6 +718,11 @@
mutex_lock(&device->mutex);
kgsl_check_suspended(device);
+ /* clean up any to-be-freed entries that belong to this
+ * process and this device
+ */
+ kgsl_cancel_events(device, dev_priv);
+
while (1) {
context = idr_get_next(&device->context_idr, &next);
if (context == NULL)
@@ -736,10 +741,6 @@
result = device->ftbl->stop(device);
kgsl_pwrctrl_set_state(device, KGSL_STATE_INIT);
}
- /* clean up any to-be-freed entries that belong to this
- * process and this device
- */
- kgsl_cancel_events(device, dev_priv);
mutex_unlock(&device->mutex);
kfree(dev_priv);