xserver: Branch 'master'

Peter Hutterer whot at kemper.freedesktop.org
Sun Dec 17 23:09:21 UTC 2017


 hw/xfree86/drivers/modesetting/drmmode_display.c |   12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

New commits:
commit c72049530503ebde493cfcd22156105557ea18d3
Author: Konstantin Kharlamov <Hi-Angel at yandex.ru>
Date:   Sun Dec 17 23:23:02 2017 +0300

    modesetting: simplify bailing on calloc fail
    
    The "done" label restores crtc-> {x,y,rotation,mode}, frees output_id.
    Doing the calloc() before writing to those values frees us from
    necessity to restore them if calloc fails, and allows to merge
    "if (mode)" block.
    
    Signed-off-by: Konstantin Kharlamov <Hi-Angel at yandex.ru>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c
index a51722b58..5b8e4fa1b 100644
--- a/hw/xfree86/drivers/modesetting/drmmode_display.c
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.c
@@ -595,6 +595,10 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
     uint32_t fb_id = 0;
     drmModeModeInfo kmode;
 
+    output_ids = calloc(sizeof(uint32_t), xf86_config->num_output);
+    if (!output_ids)
+        return FALSE;
+
     saved_mode = crtc->mode;
     saved_x = crtc->x;
     saved_y = crtc->y;
@@ -605,15 +609,7 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
         crtc->x = x;
         crtc->y = y;
         crtc->rotation = rotation;
-    }
 
-    output_ids = calloc(sizeof(uint32_t), xf86_config->num_output);
-    if (!output_ids) {
-        ret = FALSE;
-        goto done;
-    }
-
-    if (mode) {
         for (i = 0; i < xf86_config->num_output; i++) {
             xf86OutputPtr output = xf86_config->output[i];
             drmmode_output_private_ptr drmmode_output;


More information about the xorg-commit mailing list