@@ -415,6 +415,9 @@ void adreno_gpu_state_get(struct msm_gpu *gpu, struct msm_gpu_state *state)
}
}
+ if (!adreno_gpu->registers)
+ return;
+
/* Count the number of registers */
for (i = 0; adreno_gpu->registers[i] != ~0; i += 2)
count += adreno_gpu->registers[i + 1] -
@@ -550,9 +553,10 @@ void adreno_show(struct msm_gpu *gpu, struct msm_gpu_state *state,
}
}
- drm_puts(p, "registers:\n");
-
for (i = 0; i < state->nr_registers; i++) {
+ if (i == 0)
+ drm_puts(p, "registers:\n");
+
drm_printf(p, " - { offset: 0x%04x, value: 0x%08x }\n",
state->registers[i * 2] << 2,
state->registers[(i * 2) + 1]);
The gpu crashstate's base objects registers pointer can be NULL if the target implementation decides to capture the register dump on its own. This patch simply checks for NULL before dereferencing. Signed-off-by: Sharat Masetty <smasetty@codeaurora.org> --- Changes from v1: Addressed comments from Jordan Crouse drivers/gpu/drm/msm/adreno/adreno_gpu.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) -- 1.9.1