aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristian Gmeiner <[email protected]>2017-02-08 13:07:25 +0100
committerEmil Velikov <[email protected]>2017-03-01 13:34:41 +0000
commit6e3da9c81c2112e72829ed45ac34c0916de71a47 (patch)
tree749400c0b7ffacda6ac4cb2a58c8f2fc96c873f3 /src
parent42b73955808d7b33cf8f65fc8b4abe53aeaba135 (diff)
etnaviv: move pctx initialisation to avoid a null dereference
In case ctx->stream == NULL the fail label gets executed where pctx gets dereferenced - too bad pctx is NULL in that case. Caught by Coverity, reported to me by imirkin. Cc: "17.0" <[email protected]> Signed-off-by: Christian Gmeiner <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> (cherry picked from commit a0b16a08905d68da07668a42eeb464b4f30bf3e5)
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/etnaviv/etnaviv_context.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/gallium/drivers/etnaviv/etnaviv_context.c b/src/gallium/drivers/etnaviv/etnaviv_context.c
index d767cd1f38e..88580c1449a 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_context.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_context.c
@@ -251,20 +251,20 @@ etna_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
{
struct etna_context *ctx = CALLOC_STRUCT(etna_context);
struct etna_screen *screen;
- struct pipe_context *pctx = NULL;
+ struct pipe_context *pctx;
if (ctx == NULL)
return NULL;
+ pctx = &ctx->base;
+ pctx->priv = ctx;
+ pctx->screen = pscreen;
+
screen = etna_screen(pscreen);
ctx->stream = etna_cmd_stream_new(screen->pipe, 0x2000, &etna_cmd_stream_reset_notify, ctx);
if (ctx->stream == NULL)
goto fail;
- pctx = &ctx->base;
- pctx->priv = ctx;
- pctx->screen = pscreen;
-
/* context ctxate setup */
ctx->specs = screen->specs;
ctx->screen = screen;