From: Michel Dänzer <michel.daen...@amd.com>

Initialize ret = FALSE and only set it to TRUE when we've succeeded.

(Ported from amdgpu commit 3bce0519a4008cf87c0e31a7a579e10f5dcdd2f3)

Signed-off-by: Michel Dänzer <michel.daen...@amd.com>
---
 src/drmmode_display.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 25c0e99..26ba9b1 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;
-- 
2.9.3

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reply via email to