From 8ddaca16338f03c194d739497b497e018209c2e5 Mon Sep 17 00:00:00 2001 From: Lucas Stach Date: Sun, 10 Jul 2022 16:21:02 +0200 Subject: [PATCH] etnaviv: tex_desc: make error handling more consistent There already is a error handling label to free the sampler view struct and return failure. Consistently use this label to make error handling more uniform. Signed-off-by: Lucas Stach Reviewed-by: Philipp Zabel Reviewed-by: Christian Gmeiner Part-of: --- src/gallium/drivers/etnaviv/etnaviv_texture_desc.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/etnaviv/etnaviv_texture_desc.c b/src/gallium/drivers/etnaviv/etnaviv_texture_desc.c index 9891dfe..beb932c 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_texture_desc.c +++ b/src/gallium/drivers/etnaviv/etnaviv_texture_desc.c @@ -141,10 +141,8 @@ etna_create_sampler_view_desc(struct pipe_context *pctx, struct pipe_resource *p return NULL; struct etna_resource *res = etna_texture_handle_incompatible(pctx, prsc); - if (!res) { - free(sv); - return NULL; - } + if (!res) + goto error; sv->base = *so; pipe_reference_init(&sv->base.reference, 1); @@ -156,8 +154,7 @@ etna_create_sampler_view_desc(struct pipe_context *pctx, struct pipe_resource *p uint32_t target_hw = translate_texture_target(sv->base.target); if (target_hw == ETNA_NO_MATCH) { BUG("Unhandled texture target"); - free(sv); - return NULL; + goto error; } /* Texture descriptor sampler bits */ @@ -222,6 +219,7 @@ etna_create_sampler_view_desc(struct pipe_context *pctx, struct pipe_resource *p sv->DESC_ADDR.flags = ETNA_RELOC_READ; return &sv->base; + error: free(sv); return NULL; -- 2.7.4