From 02d487a59073c4bc95aef7476b145f7f16cd1713 Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Sat, 7 Oct 2017 14:01:45 +0100 Subject: [PATCH] compositor-drm: Remove NULL checks in switch_mode Calling switch_mode with no output or mode never makes any sense. Drop the NULL checks. Signed-off-by: Daniel Stone Reviewed-by: Pekka Paalanen --- libweston/compositor-drm.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c index 3ca437ba..18954e77 100644 --- a/libweston/compositor-drm.c +++ b/libweston/compositor-drm.c @@ -2593,26 +2593,13 @@ drm_output_fini_pixman(struct drm_output *output); static int drm_output_switch_mode(struct weston_output *output_base, struct weston_mode *mode) { - struct drm_output *output; - struct drm_mode *drm_mode; - struct drm_backend *b; - - if (output_base == NULL) { - weston_log("output is NULL.\n"); - return -1; - } - - if (mode == NULL) { - weston_log("mode is NULL.\n"); - return -1; - } - - b = to_drm_backend(output_base->compositor); - output = to_drm_output(output_base); - drm_mode = choose_mode (output, mode); + struct drm_output *output = to_drm_output(output_base); + struct drm_backend *b = to_drm_backend(output_base->compositor); + struct drm_mode *drm_mode = choose_mode(output, mode); if (!drm_mode) { - weston_log("%s, invalid resolution:%dx%d\n", __func__, mode->width, mode->height); + weston_log("%s: invalid resolution %dx%d\n", + output_base->name, mode->width, mode->height); return -1; }