diff options
author | Michel Dänzer <michel.daenzer@amd.com> | 2016-09-21 16:37:53 +0900 |
---|---|---|
committer | Michel Dänzer <michel@daenzer.net> | 2016-09-21 18:20:19 +0900 |
commit | 956e03d6a6b9478dd8e77c81f426c0d371c5d7a1 (patch) | |
tree | 787bdda2831f47375b0f5ba38a59804dd1da02a3 /src | |
parent | ace455d1db4db3f9b8b434a3747acfa7e1273db4 (diff) |
Simplify drmmode_set_mode_major error handling
Initialize ret = FALSE and only set it to TRUE when we've succeeded.
(Ported from amdgpu commit 3bce0519a4008cf87c0e31a7a579e10f5dcdd2f3)
Diffstat (limited to 'src')
-rw-r--r-- | src/drmmode_display.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/drmmode_display.c b/src/drmmode_display.c index 25c0e990..26ba9b16 100644 --- a/src/drmmode_display.c +++ b/src/drmmode_display.c @@ -730,7 +730,7 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode, DisplayModeRec saved_mode; uint32_t *output_ids = NULL; int output_count = 0; - Bool ret = TRUE; + Bool ret = FALSE; int i; int fb_id; drmModeModeInfo kmode; @@ -747,10 +747,8 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode, crtc->rotation = rotation; output_ids = calloc(sizeof(uint32_t), xf86_config->num_output); - if (!output_ids) { - ret = FALSE; + if (!output_ids) goto done; - } for (i = 0; i < xf86_config->num_output; i++) { xf86OutputPtr output = xf86_config->output[i]; @@ -850,7 +848,6 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode, info->front_bo->handle, &drmmode->fb_id) < 0) { ErrorF("failed to add fb\n"); - ret = FALSE; goto done; } @@ -867,8 +864,7 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode, fb_id, x, y, output_ids, output_count, &kmode) != 0) { xf86DrvMsg(crtc->scrn->scrnIndex, X_ERROR, - "failed to set mode: %s", strerror(errno)); - ret = FALSE; + "failed to set mode: %s\n", strerror(errno)); goto done; } else ret = TRUE; |