msm: kgsl: fix infinite loop in adreno_find_region()
If postmortem dump tried to parse a context switch
buffer for any context except the current context
this function would never return.
Change-Id: I19f2fe7afda5796180cdf5f81c17fad960e84f05
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
diff --git a/drivers/gpu/msm/adreno.c b/drivers/gpu/msm/adreno.c
index 2681263..d7c71ab 100644
--- a/drivers/gpu/msm/adreno.c
+++ b/drivers/gpu/msm/adreno.c
@@ -987,28 +987,27 @@
while (1) {
struct adreno_context *adreno_context = NULL;
- struct kgsl_memdesc *gpustate;
- struct kgsl_memdesc *gmemshadow;
context = idr_get_next(&device->context_idr, &next);
if (context == NULL)
break;
adreno_context = (struct adreno_context *)context->devctxt;
- if (!kgsl_mmu_pt_equal(adreno_context->pagetable, pt_base))
- continue;
+ if (kgsl_mmu_pt_equal(adreno_context->pagetable, pt_base)) {
+ struct kgsl_memdesc *desc;
- gpustate = &adreno_context->gpustate;
- if (kgsl_gpuaddr_in_memdesc(gpustate, gpuaddr, size)) {
- result = gpustate;
- return result;
- }
- gmemshadow = &adreno_context->context_gmem_shadow.gmemshadow;
- if (kgsl_gpuaddr_in_memdesc(gmemshadow, gpuaddr, size)) {
- result = gmemshadow;
- return result;
- }
+ desc = &adreno_context->gpustate;
+ if (kgsl_gpuaddr_in_memdesc(desc, gpuaddr, size)) {
+ result = desc;
+ return result;
+ }
+ desc = &adreno_context->context_gmem_shadow.gmemshadow;
+ if (kgsl_gpuaddr_in_memdesc(desc, gpuaddr, size)) {
+ result = desc;
+ return result;
+ }
+ }
next = next + 1;
}