[PATCH 3/7] drm/msm/gpu: Add some WARN_ON()s

From: Rob Clark
Date: Wed Nov 24 2021 - 16:37:36 EST


From: Rob Clark <robdclark@xxxxxxxxxxxx>

We don't expect either of these conditions to ever be true, so let's get
shouty if they are.

Signed-off-by: Rob Clark <robdclark@xxxxxxxxxxxx>
---
drivers/gpu/drm/msm/adreno/adreno_gpu.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
index a379f98aca54..6c42cc0ebe84 100644
--- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
@@ -504,6 +504,9 @@ int adreno_gpu_state_get(struct msm_gpu *gpu, struct msm_gpu_state *state)
struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu);
int i, count = 0;

+ WARN_ON(gpu->needs_hw_init);
+ WARN_ON(!mutex_is_locked(&gpu->dev->struct_mutex));
+
kref_init(&state->ref);

ktime_get_real_ts64(&state->time);
--
2.33.1