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 <l.stach@pengutronix.de>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17448>
This commit is contained in:
Lucas Stach 2022-07-10 16:21:02 +02:00 committed by Marge Bot
parent 9a48b1bdb2
commit 8ddaca1633

View file

@ -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;