On 12/20/2025 6:12 AM, Rob Clark wrote:
void a6xx_show(struct msm_gpu *gpu, struct msm_gpu_state *state,
struct drm_printer *p)
{
+ if (IS_ERR_OR_NULL(state))
+ return;
+
struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu);
struct a6xx_gpu_state *a6xx_state = container_of(state,
struct a6xx_gpu_state, base);
Are you saying that this container_of does a dereference?
I don't think so.
You're right that container_of() itself does not dereference the
pointer. My initial wording is incorrect.
it shouldn't.. but also there is no code path that reaches here with
a IS_ERR_OR_NULL(state), AFAICT
BR,
-R
-Akhil.
int i;
- if (IS_ERR_OR_NULL(state))
- return;
-
drm_printf(p, "gpu-initialized: %d\n", a6xx_state->gpu_initialized);
adreno_show(gpu, state, p);
The intent of the patch is to return early when state is NULL,
avoiding the a6xx_state and adreno_gpu assignments.
The check is intended as a defensive guard, since state is dereferenced
immediately afterwards via a6xx_state usage. That said, I agree that
there appears to be no valid code path that reaches here with
IS_ERR_OR_NULL(state), so the check is likely unnecessary.
Given that, please ignore this patch.
Thanks,
Alok