From f5c8761edab0f3982ab22de774afa81148b47795 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 14 Jul 2021 22:23:09 -0700 Subject: [PATCH] asahi: Move assignment after null check. Fix defect reported by Coverity Scan. Dereference before null check (REVERSE_INULL) check_after_deref: Null-checking so suggests that it may be null, but it has already been dereferenced on all paths leading to the check. Fixes: dcd2d8ca500 ("asahi: Track more Gallium state") Signed-off-by: Vinson Lee Part-of: --- src/gallium/drivers/asahi/agx_state.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/asahi/agx_state.c b/src/gallium/drivers/asahi/agx_state.c index ba81bd278a8..71a991798dd 100644 --- a/src/gallium/drivers/asahi/agx_state.c +++ b/src/gallium/drivers/asahi/agx_state.c @@ -828,11 +828,12 @@ agx_create_shader_state(struct pipe_context *pctx, const struct pipe_shader_state *cso) { struct agx_uncompiled_shader *so = CALLOC_STRUCT(agx_uncompiled_shader); - so->base = *cso; if (!so) return NULL; + so->base = *cso; + if (cso->type == PIPE_SHADER_IR_NIR) { so->nir = cso->ir.nir; } else {