From 5e41b44b10107b8395f4cb36ddc4dcedd46d6408 Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Tue, 7 Dec 2021 17:46:26 +0000 Subject: [PATCH] backend-drm: Change cursor checks to asserts We shouldn't get down into trying to place a view on a cursor plane if these checks are not met, so change them to asserts rather than early returns. Signed-off-by: Daniel Stone --- libweston/backend-drm/state-propose.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/libweston/backend-drm/state-propose.c b/libweston/backend-drm/state-propose.c index a022bc1b..a2bbe6ec 100644 --- a/libweston/backend-drm/state-propose.c +++ b/libweston/backend-drm/state-propose.c @@ -209,24 +209,15 @@ drm_output_prepare_cursor_view(struct drm_output_state *output_state, const char *p_name = drm_output_get_plane_type_name(plane); assert(!b->cursors_are_broken); - - if (!plane) - return NULL; - - if (!plane->state_cur->complete) - return NULL; - - if (plane->state_cur->output && plane->state_cur->output != output) - return NULL; + assert(plane); + assert(plane->state_cur->complete); + assert(!plane->state_cur->output || plane->state_cur->output == output); /* We use GBM to import SHM buffers. */ - if (b->gbm == NULL) - return NULL; + assert(b->gbm); plane_state = drm_output_state_get_plane(output_state, plane); - - if (plane_state && plane_state->fb) - return NULL; + assert(!plane_state->fb); /* We can't scale with the legacy API, and we don't try to account for * simple cropping/translation in cursor_bo_update. */