diff options
author | Simon Ser <contact@emersion.fr> | 2022-10-01 17:49:27 +0200 |
---|---|---|
committer | Alexander Orzechowski <orzechowski.alexander@gmail.com> | 2022-10-01 19:45:29 +0000 |
commit | 3e7ea8715bf6817bee847e3bc5816abf69242fc5 (patch) | |
tree | 40ab5561b6bd3a56f127c2a221e7a909a44fdfed /render/allocator | |
parent | d81f68d2b47f9794532c4650c912a386fbd3eefb (diff) |
render/allocator/drm_dumb: get format info before allocating
Simplifies error handling a bit.
Diffstat (limited to 'render/allocator')
-rw-r--r-- | render/allocator/drm_dumb.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/render/allocator/drm_dumb.c b/render/allocator/drm_dumb.c index 27aa1a8d..024e5d4f 100644 --- a/render/allocator/drm_dumb.c +++ b/render/allocator/drm_dumb.c @@ -55,20 +55,20 @@ static struct wlr_drm_dumb_buffer *create_buffer( return NULL; } - struct wlr_drm_dumb_buffer *buffer = calloc(1, sizeof(*buffer)); - if (buffer == NULL) { - return NULL; - } - wlr_buffer_init(&buffer->base, &buffer_impl, width, height); - wl_list_insert(&alloc->buffers, &buffer->link); - const struct wlr_pixel_format_info *info = drm_get_pixel_format_info(format->format); if (info == NULL) { wlr_log(WLR_ERROR, "DRM format 0x%"PRIX32" not supported", format->format); - goto create_err; + return NULL; + } + + struct wlr_drm_dumb_buffer *buffer = calloc(1, sizeof(*buffer)); + if (buffer == NULL) { + return NULL; } + wlr_buffer_init(&buffer->base, &buffer_impl, width, height); + wl_list_insert(&alloc->buffers, &buffer->link); struct drm_mode_create_dumb create = {0}; create.width = (uint32_t)width; |