summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2019-01-04 19:30:48 -0500
committerMarek Olšák <[email protected]>2019-01-30 12:35:22 -0500
commit16672f16da00f0fdc70115a69193e907684ff4c0 (patch)
treec71709d7a833cba86830e375f77bd430e572e5e0
parent2361558eb71de4a2f65e1e74374d7ab2ffaa3499 (diff)
radeonsi: unify error paths in si_texture_create_object
-rw-r--r--src/gallium/drivers/radeonsi/si_texture.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/gallium/drivers/radeonsi/si_texture.c b/src/gallium/drivers/radeonsi/si_texture.c
index 0f31303592a..422b0bc3a85 100644
--- a/src/gallium/drivers/radeonsi/si_texture.c
+++ b/src/gallium/drivers/radeonsi/si_texture.c
@@ -1111,7 +1111,7 @@ si_texture_create_object(struct pipe_screen *screen,
tex = CALLOC_STRUCT(si_texture);
if (!tex)
- return NULL;
+ goto error;
resource = &tex->buffer;
resource->b.b = *base;
@@ -1186,10 +1186,8 @@ si_texture_create_object(struct pipe_screen *screen,
tex->cb_color_info |= S_028C70_FAST_CLEAR(1);
tex->cmask_buffer = &tex->buffer;
- if (!tex->surface.fmask_size || !tex->surface.cmask_size) {
- FREE(tex);
- return NULL;
- }
+ if (!tex->surface.fmask_size || !tex->surface.cmask_size)
+ goto error;
}
/* Shared textures must always set up DCC here.
@@ -1210,10 +1208,8 @@ si_texture_create_object(struct pipe_screen *screen,
si_init_resource_fields(sscreen, resource, tex->size,
tex->surface.surf_alignment);
- if (!si_alloc_resource(sscreen, resource)) {
- FREE(tex);
- return NULL;
- }
+ if (!si_alloc_resource(sscreen, resource))
+ goto error;
} else {
resource->buf = buf;
resource->gpu_address = sscreen->ws->buffer_get_virtual_address(resource->buf);
@@ -1275,6 +1271,10 @@ si_texture_create_object(struct pipe_screen *screen,
}
return tex;
+
+error:
+ FREE(tex);
+ return NULL;
}
static enum radeon_surf_mode